unleash-server 4.10.0-beta.5 → 4.10.0
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 +8 -0
- package/dist/lib/addons/addon.d.ts +1 -1
- package/dist/lib/addons/addon.js +10 -11
- package/dist/lib/addons/addon.js.map +1 -1
- package/dist/lib/addons/addon.test.js +41 -18
- package/dist/lib/addons/addon.test.js.map +1 -1
- package/dist/lib/app.js +6 -0
- package/dist/lib/app.js.map +1 -1
- package/dist/lib/middleware/demo-authentication.d.ts +2 -1
- package/dist/lib/middleware/demo-authentication.js +2 -1
- package/dist/lib/middleware/demo-authentication.js.map +1 -1
- package/dist/lib/middleware/no-authentication.js +1 -0
- package/dist/lib/middleware/no-authentication.js.map +1 -1
- package/dist/lib/openapi/index.d.ts +2 -0
- package/dist/lib/openapi/index.js +46 -0
- package/dist/lib/openapi/index.js.map +1 -0
- package/dist/lib/openapi/spec/constraint-schema.d.ts +40 -0
- package/dist/lib/openapi/spec/constraint-schema.js +25 -0
- package/dist/lib/openapi/spec/constraint-schema.js.map +1 -0
- package/dist/lib/openapi/spec/create-feature-request.d.ts +2 -0
- package/dist/lib/openapi/spec/create-feature-request.js +14 -0
- package/dist/lib/openapi/spec/create-feature-request.js.map +1 -0
- package/dist/lib/openapi/spec/create-feature-schema.d.ts +39 -0
- package/dist/lib/openapi/spec/create-feature-schema.js +24 -0
- package/dist/lib/openapi/spec/create-feature-schema.js.map +1 -0
- package/dist/lib/openapi/spec/feature-response.d.ts +2 -0
- package/dist/lib/openapi/spec/feature-response.js +14 -0
- package/dist/lib/openapi/spec/feature-response.js.map +1 -0
- package/dist/lib/openapi/spec/feature-schema.d.ts +103 -0
- package/dist/lib/openapi/spec/feature-schema.js +56 -0
- package/dist/lib/openapi/spec/feature-schema.js.map +1 -0
- package/dist/lib/openapi/spec/features-response.d.ts +2 -0
- package/dist/lib/openapi/spec/features-response.js +14 -0
- package/dist/lib/openapi/spec/features-response.js.map +1 -0
- package/dist/lib/openapi/spec/features-schema.d.ts +34 -0
- package/dist/lib/openapi/spec/features-schema.js +22 -0
- package/dist/lib/openapi/spec/features-schema.js.map +1 -0
- package/dist/lib/openapi/spec/override-schema.d.ts +34 -0
- package/dist/lib/openapi/spec/override-schema.js +22 -0
- package/dist/lib/openapi/spec/override-schema.js.map +1 -0
- package/dist/lib/openapi/spec/strategy-schema.d.ts +46 -0
- package/dist/lib/openapi/spec/strategy-schema.js +28 -0
- package/dist/lib/openapi/spec/strategy-schema.js.map +1 -0
- package/dist/lib/openapi/spec/variant-schema.d.ts +58 -0
- package/dist/lib/openapi/spec/variant-schema.js +34 -0
- package/dist/lib/openapi/spec/variant-schema.js.map +1 -0
- package/dist/lib/openapi/types.d.ts +11 -0
- package/dist/lib/openapi/types.js +7 -0
- package/dist/lib/openapi/types.js.map +1 -0
- package/dist/lib/routes/admin-api/api-token-controller.d.ts +1 -1
- package/dist/lib/routes/admin-api/api-token-controller.js +13 -16
- package/dist/lib/routes/admin-api/api-token-controller.js.map +1 -1
- package/dist/lib/routes/admin-api/archive.d.ts +4 -3
- package/dist/lib/routes/admin-api/archive.js +15 -4
- package/dist/lib/routes/admin-api/archive.js.map +1 -1
- package/dist/lib/routes/admin-api/email.d.ts +3 -2
- package/dist/lib/routes/admin-api/email.js +0 -2
- package/dist/lib/routes/admin-api/email.js.map +1 -1
- package/dist/lib/routes/admin-api/feature.d.ts +3 -2
- package/dist/lib/routes/admin-api/feature.js +15 -2
- package/dist/lib/routes/admin-api/feature.js.map +1 -1
- package/dist/lib/routes/admin-api/project/features.d.ts +5 -3
- package/dist/lib/routes/admin-api/project/features.js +43 -5
- package/dist/lib/routes/admin-api/project/features.js.map +1 -1
- package/dist/lib/routes/admin-api/strategy.d.ts +9 -7
- package/dist/lib/routes/admin-api/strategy.js +0 -7
- package/dist/lib/routes/admin-api/strategy.js.map +1 -1
- package/dist/lib/routes/client-api/register.test.js +13 -0
- package/dist/lib/routes/client-api/register.test.js.map +1 -1
- package/dist/lib/routes/controller.d.ts +13 -2
- package/dist/lib/routes/controller.js +46 -7
- package/dist/lib/routes/controller.js.map +1 -1
- package/dist/lib/server-impl.js +0 -2
- package/dist/lib/server-impl.js.map +1 -1
- package/dist/lib/services/addon-service-test-simple-addon.js +1 -1
- package/dist/lib/services/addon-service-test-simple-addon.js.map +1 -1
- package/dist/lib/services/client-metrics/schema.js +2 -2
- package/dist/lib/services/client-metrics/schema.js.map +1 -1
- package/dist/lib/services/client-metrics/schema.test.d.ts +1 -0
- package/dist/lib/services/client-metrics/schema.test.js +87 -0
- package/dist/lib/services/client-metrics/schema.test.js.map +1 -0
- package/dist/lib/services/feature-toggle-service.d.ts +2 -1
- package/dist/lib/services/feature-toggle-service.js +2 -1
- package/dist/lib/services/feature-toggle-service.js.map +1 -1
- package/dist/lib/services/index.js +3 -0
- package/dist/lib/services/index.js.map +1 -1
- package/dist/lib/services/openapi-service.d.ts +16 -0
- package/dist/lib/services/openapi-service.js +52 -0
- package/dist/lib/services/openapi-service.js.map +1 -0
- package/dist/lib/services/state-service.d.ts +2 -1
- package/dist/lib/services/state-service.js +2 -2
- package/dist/lib/services/state-service.js.map +1 -1
- package/dist/lib/services/version-service.js +2 -2
- package/dist/lib/services/version-service.js.map +1 -1
- package/dist/lib/services/version-service.test.js +34 -15
- package/dist/lib/services/version-service.test.js.map +1 -1
- package/dist/lib/types/mutable.d.ts +6 -0
- package/dist/lib/types/mutable.js +3 -0
- package/dist/lib/types/mutable.js.map +1 -0
- package/dist/lib/types/permissions.d.ts +1 -0
- package/dist/lib/types/permissions.js +2 -1
- package/dist/lib/types/permissions.js.map +1 -1
- package/dist/lib/types/services.d.ts +2 -0
- package/dist/lib/types/stores/project-store.d.ts +1 -1
- package/dist/lib/util/load-index-html.js +2 -2
- package/dist/lib/util/load-index-html.js.map +1 -1
- package/dist/lib/util/serialize-dates.d.ts +5 -0
- package/dist/lib/util/serialize-dates.js +17 -0
- package/dist/lib/util/serialize-dates.js.map +1 -0
- package/dist/lib/util/serialize-dates.test.d.ts +1 -0
- package/dist/lib/util/serialize-dates.test.js +17 -0
- package/dist/lib/util/serialize-dates.test.js.map +1 -0
- package/dist/migrations/20220425090847-add-token-permission.d.ts +2 -0
- package/dist/migrations/20220425090847-add-token-permission.js +31 -0
- package/dist/migrations/20220425090847-add-token-permission.js.map +1 -0
- package/dist/test/config/test-config.js +3 -6
- package/dist/test/config/test-config.js.map +1 -1
- package/dist/test/e2e/api/admin/api-token.auth.e2e.test.js +34 -7
- package/dist/test/e2e/api/admin/api-token.auth.e2e.test.js.map +1 -1
- package/dist/test/e2e/api/openapi/openapi.e2e.test.d.ts +1 -0
- package/dist/test/e2e/api/openapi/openapi.e2e.test.js +39 -0
- package/dist/test/e2e/api/openapi/openapi.e2e.test.js.map +1 -0
- package/package.json +19 -17
package/README.md
CHANGED
|
@@ -110,6 +110,14 @@ We'd love to have your help too: Please feel free to open issues or provide pull
|
|
|
110
110
|
|
|
111
111
|
Check out [the CONTRIBUTING.md file](./CONTRIBUTING.md) for contribution guidelines and the [Unleash developer guide](./website/docs/contributing/developer-guide.md) for tips on environment setup, running the tests, and running Unleash from source.
|
|
112
112
|
|
|
113
|
+
### Contributors
|
|
114
|
+
|
|
115
|
+
<div align="center">
|
|
116
|
+
|
|
117
|
+
[](https://github.com/Unleash/unleash/graphs/contributors)
|
|
118
|
+
|
|
119
|
+
</div>
|
|
120
|
+
|
|
113
121
|
<br/>
|
|
114
122
|
|
|
115
123
|
## Features our users love
|
|
@@ -10,6 +10,6 @@ export default abstract class Addon {
|
|
|
10
10
|
constructor(definition: IAddonDefinition, { getLogger }: Pick<IUnleashConfig, 'getLogger'>);
|
|
11
11
|
get name(): string;
|
|
12
12
|
get definition(): IAddonDefinition;
|
|
13
|
-
fetchRetry(url: string, options?: {}, retries?: number
|
|
13
|
+
fetchRetry(url: string, options?: {}, retries?: number): Promise<Response>;
|
|
14
14
|
abstract handleEvent(event: IEvent, parameters: any): Promise<void>;
|
|
15
15
|
}
|
package/dist/lib/addons/addon.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const make_fetch_happen_1 = __importDefault(require("make-fetch-happen"));
|
|
7
7
|
const addon_schema_1 = require("./addon-schema");
|
|
8
8
|
class Addon {
|
|
9
9
|
constructor(definition, { getLogger }) {
|
|
@@ -22,20 +22,19 @@ class Addon {
|
|
|
22
22
|
get definition() {
|
|
23
23
|
return this._definition;
|
|
24
24
|
}
|
|
25
|
-
async fetchRetry(url, options = {}, retries = 1
|
|
26
|
-
const retryCodes = [408, 500, 502, 503, 504, 522, 524];
|
|
25
|
+
async fetchRetry(url, options = {}, retries = 1) {
|
|
27
26
|
let res;
|
|
28
27
|
try {
|
|
29
|
-
res = await (0,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
res = await (0, make_fetch_happen_1.default)(url, {
|
|
29
|
+
retry: {
|
|
30
|
+
retries,
|
|
31
|
+
},
|
|
32
|
+
...options,
|
|
33
|
+
});
|
|
35
34
|
return res;
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
catch (e) {
|
|
37
|
+
res = { statusCode: e.code, ok: false };
|
|
39
38
|
}
|
|
40
39
|
return res;
|
|
41
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addon.js","sourceRoot":"","sources":["../../../src/lib/addons/addon.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"addon.js","sourceRoot":"","sources":["../../../src/lib/addons/addon.ts"],"names":[],"mappings":";;;;;AACA,0EAAsC;AACtC,iDAAuD;AAMvD,MAA8B,KAAK;IAO/B,YACI,UAA4B,EAC5B,EAAE,SAAS,EAAqC;QAEhD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,SAAS,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;QACpD,MAAM,EAAE,KAAK,EAAE,GAAG,oCAAqB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC7D,IAAI,KAAK,EAAE;YACP,IAAI,CAAC,MAAM,CAAC,IAAI,CACZ,iCAAiC,UAAU,CAAC,IAAI,EAAE,EAClD,KAAK,CACR,CAAC;YACF,MAAM,KAAK,CAAC;SACf;QACD,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,UAAU,CACZ,GAAW,EACX,OAAO,GAAG,EAAE,EACZ,UAAkB,CAAC;QAEnB,IAAI,GAAG,CAAC;QACR,IAAI;YACA,GAAG,GAAG,MAAM,IAAA,2BAAK,EAAC,GAAG,EAAE;gBACnB,KAAK,EAAE;oBACH,OAAO;iBACV;gBACD,GAAG,OAAO;aACb,CAAC,CAAC;YACH,OAAO,GAAG,CAAC;SACd;QAAC,OAAO,CAAC,EAAE;YACR,GAAG,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;SAC3C;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CAIJ;AAtDD,wBAsDC"}
|
|
@@ -3,40 +3,63 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const nock_1 = __importDefault(require("nock"));
|
|
7
7
|
const no_logger_1 = __importDefault(require("../../test/fixtures/no-logger"));
|
|
8
8
|
const slack_1 = __importDefault(require("./slack"));
|
|
9
9
|
beforeEach(() => {
|
|
10
|
-
|
|
10
|
+
nock_1.default.disableNetConnect();
|
|
11
11
|
});
|
|
12
|
-
test('
|
|
12
|
+
test('Does not retry if request succeeds', async () => {
|
|
13
13
|
const url = 'https://test.some.com';
|
|
14
|
-
jest.useFakeTimers('modern');
|
|
15
14
|
const addon = new slack_1.default({
|
|
16
15
|
getLogger: no_logger_1.default,
|
|
17
16
|
unleashUrl: url,
|
|
18
17
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
(0, nock_1.default)(url).get('/').reply(201);
|
|
19
|
+
const res = await addon.fetchRetry(url);
|
|
20
|
+
expect(res.ok).toBe(true);
|
|
21
|
+
});
|
|
22
|
+
test('Retries once, and succeeds', async () => {
|
|
23
|
+
const url = 'https://test.some.com';
|
|
24
|
+
const addon = new slack_1.default({
|
|
25
|
+
getLogger: no_logger_1.default,
|
|
26
|
+
unleashUrl: url,
|
|
22
27
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
(0, nock_1.default)(url).get('/').replyWithError('testing retry');
|
|
29
|
+
(0, nock_1.default)(url).get('/').reply(200);
|
|
30
|
+
const res = await addon.fetchRetry(url);
|
|
31
|
+
expect(res.ok).toBe(true);
|
|
32
|
+
expect(nock_1.default.isDone()).toBe(true);
|
|
26
33
|
});
|
|
27
|
-
test('
|
|
34
|
+
test('Does not throw if response is error', async () => {
|
|
28
35
|
const url = 'https://test.some.com';
|
|
29
|
-
jest.useFakeTimers('modern');
|
|
30
36
|
const addon = new slack_1.default({
|
|
31
37
|
getLogger: no_logger_1.default,
|
|
32
38
|
unleashUrl: url,
|
|
33
39
|
});
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
(0, nock_1.default)(url).get('/').twice().replyWithError('testing retry');
|
|
41
|
+
const res = await addon.fetchRetry(url);
|
|
42
|
+
expect(res.ok).toBe(false);
|
|
43
|
+
});
|
|
44
|
+
test('Supports custom number of retries', async () => {
|
|
45
|
+
const url = 'https://test.some.com';
|
|
46
|
+
const addon = new slack_1.default({
|
|
47
|
+
getLogger: no_logger_1.default,
|
|
48
|
+
unleashUrl: url,
|
|
36
49
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
let retries = 0;
|
|
51
|
+
(0, nock_1.default)(url).get('/').twice().replyWithError('testing retry');
|
|
52
|
+
(0, nock_1.default)(url).get('/').reply(201);
|
|
53
|
+
const res = await addon.fetchRetry(url, {
|
|
54
|
+
onRetry: () => {
|
|
55
|
+
retries = retries + 1;
|
|
56
|
+
},
|
|
57
|
+
}, 2);
|
|
58
|
+
expect(retries).toBe(2);
|
|
59
|
+
expect(res.ok).toBe(true);
|
|
60
|
+
expect(nock_1.default.isDone()).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
afterEach(() => {
|
|
63
|
+
nock_1.default.enableNetConnect();
|
|
41
64
|
});
|
|
42
65
|
//# sourceMappingURL=addon.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addon.test.js","sourceRoot":"","sources":["../../../src/lib/addons/addon.test.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"addon.test.js","sourceRoot":"","sources":["../../../src/lib/addons/addon.test.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,8EAAqD;AAErD,oDAAiC;AAEjC,UAAU,CAAC,GAAG,EAAE;IACZ,cAAI,CAAC,iBAAiB,EAAE,CAAC;AAC7B,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;IAClD,MAAM,GAAG,GAAG,uBAAuB,CAAC;IACpC,MAAM,KAAK,GAAG,IAAI,eAAU,CAAC;QACzB,SAAS,EAAE,mBAAQ;QACnB,UAAU,EAAE,GAAG;KAClB,CAAC,CAAC;IACH,IAAA,cA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(config, stores, services, unleashSession) {
|
|
|
54
54
|
if (config.enableOAS) {
|
|
55
55
|
app.use(`${baseUriPath}/oas`, express_1.default.static('docs/api/oas'));
|
|
56
56
|
}
|
|
57
|
+
if (config.enableOAS && services.openApiService) {
|
|
58
|
+
services.openApiService.useDocs(app);
|
|
59
|
+
}
|
|
57
60
|
switch (config.authentication.type) {
|
|
58
61
|
case option_1.IAuthType.OPEN_SOURCE: {
|
|
59
62
|
app.use(baseUriPath, (0, api_token_middleware_1.default)(config, services));
|
|
@@ -96,6 +99,9 @@ async function getApp(config, stores, services, unleashSession) {
|
|
|
96
99
|
}
|
|
97
100
|
// Setup API routes
|
|
98
101
|
app.use(`${baseUriPath}/`, new routes_1.default(config, services).router);
|
|
102
|
+
if (services.openApiService) {
|
|
103
|
+
services.openApiService.useErrorHandler(app);
|
|
104
|
+
}
|
|
99
105
|
if (process.env.NODE_ENV !== 'production') {
|
|
100
106
|
app.use((0, errorhandler_1.default)());
|
|
101
107
|
}
|
package/dist/lib/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/lib/app.ts"],"names":[],"mappings":";;;;;AAAA,uDAAgD;AAChD,sDAA+D;AAC/D,gDAAwB;AACxB,8DAAsC;AACtC,kEAAoC;AACpC,kEAAyC;AACzC,gDAAwB;AACxB,gEAAwC;AACxC,8EAAyE;AACzE,mFAA0D;AAC1D,6FAAmE;AAEnE,2CAA2D;AAG3D,sDAAmC;AAEnC,iFAAwD;AACxD,2FAAkE;AAClE,yFAAgE;AAChE,uFAA8D;AAC9D,iFAAwD;AAExD,4DAAuD;AAExC,KAAK,UAAU,MAAM,CAChC,MAAsB,EACtB,MAAsB,EACtB,QAA0B,EAC1B,cAA+B;IAE/B,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;IAEtB,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC;IAEpD,IAAI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a,KAAK,UAAU,EAAE;QAC5C,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KACvD;IAED,mBAAmB;IACnB,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,GAAG,EAAE,IAAI,gBAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IAErE,IAAI,QAAQ,CAAC,cAAc,EAAE;QACzB,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;KAChD;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACvC,GAAG,CAAC,GAAG,CAAC,IAAA,sBAAY,GAAE,CAAC,CAAC;KAC3B;IAED,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACnC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACrC,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,WAAW,MAAM,CAAC,EAAE;YAC3C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC,CAAC;YACrD,OAAO;SACV;QAED,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACf,CAAC;AApID,yBAoIC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Application } from 'express';
|
|
2
2
|
import { IUnleashServices } from '../types/services';
|
|
3
3
|
import { IUnleashConfig } from '../types/option';
|
|
4
|
-
declare function demoAuthentication(app: Application, basePath: string,
|
|
4
|
+
declare function demoAuthentication(app: Application, basePath: string, // eslint-disable-line
|
|
5
|
+
{ userService }: Pick<IUnleashServices, 'userService'>, { authentication }: Pick<IUnleashConfig, 'authentication'>): void;
|
|
5
6
|
export default demoAuthentication;
|
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const authentication_required_1 = __importDefault(require("../types/authentication-required"));
|
|
7
7
|
const api_user_1 = __importDefault(require("../types/api-user"));
|
|
8
8
|
const api_token_1 = require("../types/models/api-token");
|
|
9
|
-
function demoAuthentication(app, basePath = '',
|
|
9
|
+
function demoAuthentication(app, basePath = '', // eslint-disable-line
|
|
10
|
+
{ userService }, { authentication }) {
|
|
10
11
|
app.post(`${basePath}/auth/demo/login`, async (req, res) => {
|
|
11
12
|
const { email } = req.body;
|
|
12
13
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"demo-authentication.js","sourceRoot":"","sources":["../../../src/lib/middleware/demo-authentication.ts"],"names":[],"mappings":";;;;;AACA,+FAAsE;AAGtE,iEAAwC;AACxC,yDAAyD;AAEzD,SAAS,kBAAkB,CACvB,GAAgB,EAChB,WAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"demo-authentication.js","sourceRoot":"","sources":["../../../src/lib/middleware/demo-authentication.ts"],"names":[],"mappings":";;;;;AACA,+FAAsE;AAGtE,iEAAwC;AACxC,yDAAyD;AAEzD,SAAS,kBAAkB,CACvB,GAAgB,EAChB,WAAmB,EAAE,EAAE,sBAAsB;AAC7C,EAAE,WAAW,EAAyC,EACtD,EAAE,cAAc,EAA0C;IAE1D,GAAG,CAAC,IAAI,CAAC,GAAG,QAAQ,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QACvD,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAC3B,IAAI;YACA,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,wBAAwB,CACnD,KAAK,EACL,IA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G,EAAE,IAAI,EAAE,EAAE;QAC1C,aAAa;QACb,IAAI,GAAG,CAAC,IAAI,EAAE;YACV,OAAO,IAAI,EAAE,CAAC;SACjB;QACD,OAAO,GAAG;aACL,MAAM,CAAC,GAAG,CAAC;aACX,IAAI,CACD,IAAI,iCAAsB,CAAC;YACvB,IAAI,EAAE,GAAG,QAAQ,kBAAkB;YACnC,IAAI,EAAE,MAAM;YACZ,OAAO,EACH,wDAAwD;SAC/D,CAAC,CACL;aACA,GAAG,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;AACP,CAAC;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const no_auth_user_1 = __importDefault(require("../types/no-auth-user"));
|
|
7
|
+
// eslint-disable-next-line
|
|
7
8
|
function noneAuthentication(basePath = '', app) {
|
|
8
9
|
app.use(`${basePath}/api/admin/`, (req, res, next) => {
|
|
9
10
|
// @ts-ignore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-authentication.js","sourceRoot":"","sources":["../../../src/lib/middleware/no-authentication.ts"],"names":[],"mappings":";;;;;AACA,yEAA+C;AAE/C,SAAS,kBAAkB,CAAC,QAAQ,GAAG,EAAE,EAAE,GAAgB;IACvD,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACjD,aAAa;QACb,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;YACX,mBAAmB;YACnB,GAAG,CAAC,IAAI,GAAG,IAAI,sBAAU,EAAE,CAAC;SAC/B;QACD,IAAI,EAAE,CAAC;IACX,CAAC,CAAC,CAAC;AACP,CAAC;AACD,kBAAe,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"no-authentication.js","sourceRoot":"","sources":["../../../src/lib/middleware/no-authentication.ts"],"names":[],"mappings":";;;;;AACA,yEAA+C;AAE/C,2BAA2B;AAC3B,SAAS,kBAAkB,CAAC,QAAQ,GAAG,EAAE,EAAE,GAAgB;IACvD,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACjD,aAAa;QACb,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;YACX,mBAAmB;YACnB,GAAG,CAAC,IAAI,GAAG,IAAI,sBAAU,EAAE,CAAC;SAC/B;QACD,IAAI,EAAE,CAAC;IACX,CAAC,CAAC,CAAC;AACP,CAAC;AACD,kBAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createOpenApiSchema = void 0;
|
|
4
|
+
const features_schema_1 = require("./spec/features-schema");
|
|
5
|
+
const feature_schema_1 = require("./spec/feature-schema");
|
|
6
|
+
const strategy_schema_1 = require("./spec/strategy-schema");
|
|
7
|
+
const variant_schema_1 = require("./spec/variant-schema");
|
|
8
|
+
const override_schema_1 = require("./spec/override-schema");
|
|
9
|
+
const create_feature_schema_1 = require("./spec/create-feature-schema");
|
|
10
|
+
const constraint_schema_1 = require("./spec/constraint-schema");
|
|
11
|
+
// Create the base OpenAPI schema, with everything except paths.
|
|
12
|
+
const createOpenApiSchema = (serverUrl) => {
|
|
13
|
+
return {
|
|
14
|
+
openapi: '3.0.3',
|
|
15
|
+
servers: serverUrl ? [{ url: serverUrl }] : [],
|
|
16
|
+
info: {
|
|
17
|
+
title: 'Unleash API',
|
|
18
|
+
version: process.env.npm_package_version,
|
|
19
|
+
},
|
|
20
|
+
security: [
|
|
21
|
+
{
|
|
22
|
+
apiKey: [],
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
components: {
|
|
26
|
+
securitySchemes: {
|
|
27
|
+
apiKey: {
|
|
28
|
+
type: 'apiKey',
|
|
29
|
+
in: 'header',
|
|
30
|
+
name: 'Authorization',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
schemas: {
|
|
34
|
+
createFeatureSchema: create_feature_schema_1.createFeatureSchema,
|
|
35
|
+
featuresSchema: features_schema_1.featuresSchema,
|
|
36
|
+
featureSchema: feature_schema_1.featureSchema,
|
|
37
|
+
strategySchema: strategy_schema_1.strategySchema,
|
|
38
|
+
variantSchema: variant_schema_1.variantSchema,
|
|
39
|
+
overrideSchema: override_schema_1.overrideSchema,
|
|
40
|
+
constraintSchema: constraint_schema_1.constraintSchema,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
exports.createOpenApiSchema = createOpenApiSchema;
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/openapi/index.ts"],"names":[],"mappings":";;;AACA,4DAAwD;AACxD,0DAAsD;AACtD,4DAAwD;AACxD,0DAAsD;AACtD,4DAAwD;AACxD,wEAAmE;AACnE,gEAA4D;AAE5D,gEAAgE;AACzD,MAAM,mBAAmB,GAAG,CAC/B,SAAkB,EACe,EAAE;IACnC,OAAO;QACH,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE;QAC9C,IAAI,EAAE;YACF,KAAK,EAAE,aAAa;YACpB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB;SAC3C;QACD,QAAQ,EAAE;YACN;gBACI,MAAM,EAAE,EAAE;aACb;SACJ;QACD,UAAU,EAAE;YACR,eAAe,EAAE;gBACb,MAAM,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,EAAE,EAAE,QAAQ;oBACZ,IAAI,EAAE,eAAe;iBACxB;aACJ;YACD,OAAO,EAAE;gBACL,mBAAmB,EAAnB,2CAAmB;gBACnB,cAAc,EAAd,gCAAc;gBACd,aAAa,EAAb,8BAAa;gBACb,cAAc,EAAd,gCAAc;gBACd,aAAa,EAAb,8BAAa;gBACb,cAAc,EAAd,gCAAc;gBACd,gBAAgB,EAAhB,oCAAgB;aACnB;SACJ;KACJ,CAAC;AACN,CAAC,CAAC;AAlCW,QAAA,mBAAmB,uBAkC9B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CreateSchemaType } from '../types';
|
|
2
|
+
export declare const schema: {
|
|
3
|
+
readonly type: "object";
|
|
4
|
+
readonly additionalProperties: false;
|
|
5
|
+
readonly required: readonly ["contextName", "operator"];
|
|
6
|
+
readonly properties: {
|
|
7
|
+
readonly contextName: {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
};
|
|
10
|
+
readonly operator: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
};
|
|
13
|
+
readonly values: {
|
|
14
|
+
readonly type: "array";
|
|
15
|
+
readonly items: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare type ConstraintSchema = CreateSchemaType<typeof schema>;
|
|
22
|
+
export declare const constraintSchema: import("../../types/mutable").DeepMutable<{
|
|
23
|
+
readonly type: "object";
|
|
24
|
+
readonly additionalProperties: false;
|
|
25
|
+
readonly required: readonly ["contextName", "operator"];
|
|
26
|
+
readonly properties: {
|
|
27
|
+
readonly contextName: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
};
|
|
30
|
+
readonly operator: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
};
|
|
33
|
+
readonly values: {
|
|
34
|
+
readonly type: "array";
|
|
35
|
+
readonly items: {
|
|
36
|
+
readonly type: "string";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constraintSchema = exports.schema = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
exports.schema = {
|
|
6
|
+
type: 'object',
|
|
7
|
+
additionalProperties: false,
|
|
8
|
+
required: ['contextName', 'operator'],
|
|
9
|
+
properties: {
|
|
10
|
+
contextName: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
},
|
|
13
|
+
operator: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
},
|
|
16
|
+
values: {
|
|
17
|
+
type: 'array',
|
|
18
|
+
items: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
exports.constraintSchema = (0, types_1.createSchemaObject)(exports.schema);
|
|
25
|
+
//# sourceMappingURL=constraint-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraint-schema.js","sourceRoot":"","sources":["../../../../src/lib/openapi/spec/constraint-schema.ts"],"names":[],"mappings":";;;AAAA,oCAAgE;AAEnD,QAAA,MAAM,GAAG;IAClB,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,QAAQ,EAAE,CAAC,aAAa,EAAE,UAAU,CAAC;IACrC,UAAU,EAAE;QACR,WAAW,EAAE;YACT,IAAI,EAAE,QAAQ;SACjB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,QAAQ;SACjB;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACH,IAAI,EAAE,QAAQ;aACjB;SACJ;KACJ;CACK,CAAC;AAIE,QAAA,gBAAgB,GAAG,IAAA,0BAAkB,EAAC,cAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFeatureRequest = void 0;
|
|
4
|
+
exports.createFeatureRequest = {
|
|
5
|
+
required: true,
|
|
6
|
+
content: {
|
|
7
|
+
'application/json': {
|
|
8
|
+
schema: {
|
|
9
|
+
$ref: '#/components/schemas/createFeatureSchema',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=create-feature-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-feature-request.js","sourceRoot":"","sources":["../../../../src/lib/openapi/spec/create-feature-request.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAgC;IAC7D,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE;QACL,kBAAkB,EAAE;YAChB,MAAM,EAAE;gBACJ,IAAI,EAAE,0CAA0C;aACnD;SACJ;KACJ;CACJ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CreateSchemaType } from '../types';
|
|
2
|
+
declare const schema: {
|
|
3
|
+
readonly type: "object";
|
|
4
|
+
readonly required: readonly ["name"];
|
|
5
|
+
readonly properties: {
|
|
6
|
+
readonly name: {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
};
|
|
9
|
+
readonly type: {
|
|
10
|
+
readonly type: "string";
|
|
11
|
+
};
|
|
12
|
+
readonly description: {
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
};
|
|
15
|
+
readonly impressionData: {
|
|
16
|
+
readonly type: "boolean";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare type CreateFeatureSchema = CreateSchemaType<typeof schema>;
|
|
21
|
+
export declare const createFeatureSchema: import("../../types/mutable").DeepMutable<{
|
|
22
|
+
readonly type: "object";
|
|
23
|
+
readonly required: readonly ["name"];
|
|
24
|
+
readonly properties: {
|
|
25
|
+
readonly name: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
};
|
|
28
|
+
readonly type: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
};
|
|
31
|
+
readonly description: {
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
};
|
|
34
|
+
readonly impressionData: {
|
|
35
|
+
readonly type: "boolean";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFeatureSchema = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const schema = {
|
|
6
|
+
type: 'object',
|
|
7
|
+
required: ['name'],
|
|
8
|
+
properties: {
|
|
9
|
+
name: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
},
|
|
12
|
+
type: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
},
|
|
15
|
+
description: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
},
|
|
18
|
+
impressionData: {
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
exports.createFeatureSchema = (0, types_1.createSchemaObject)(schema);
|
|
24
|
+
//# sourceMappingURL=create-feature-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-feature-schema.js","sourceRoot":"","sources":["../../../../src/lib/openapi/spec/create-feature-schema.ts"],"names":[],"mappings":";;;AAAA,oCAAgE;AAEhE,MAAM,MAAM,GAAG;IACX,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,MAAM,CAAC;IAClB,UAAU,EAAE;QACR,IAAI,EAAE;YACF,IAAI,EAAE,QAAQ;SACjB;QACD,IAAI,EAAE;YACF,IAAI,EAAE,QAAQ;SACjB;QACD,WAAW,EAAE;YACT,IAAI,EAAE,QAAQ;SACjB;QACD,cAAc,EAAE;YACZ,IAAI,EAAE,SAAS;SAClB;KACJ;CACK,CAAC;AAIE,QAAA,mBAAmB,GAAG,IAAA,0BAAkB,EAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.featureResponse = void 0;
|
|
4
|
+
exports.featureResponse = {
|
|
5
|
+
description: 'featureResponse',
|
|
6
|
+
content: {
|
|
7
|
+
'application/json': {
|
|
8
|
+
schema: {
|
|
9
|
+
$ref: '#/components/schemas/featureSchema',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=feature-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-response.js","sourceRoot":"","sources":["../../../../src/lib/openapi/spec/feature-response.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAA6B;IACrD,WAAW,EAAE,iBAAiB;IAC9B,OAAO,EAAE;QACL,kBAAkB,EAAE;YAChB,MAAM,EAAE;gBACJ,IAAI,EAAE,oCAAoC;aAC7C;SACJ;KACJ;CACJ,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { CreateSchemaType } from '../types';
|
|
2
|
+
declare const schema: {
|
|
3
|
+
readonly type: "object";
|
|
4
|
+
readonly additionalProperties: false;
|
|
5
|
+
readonly required: readonly ["name", "project"];
|
|
6
|
+
readonly properties: {
|
|
7
|
+
readonly name: {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
};
|
|
10
|
+
readonly type: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
};
|
|
13
|
+
readonly description: {
|
|
14
|
+
readonly type: "string";
|
|
15
|
+
};
|
|
16
|
+
readonly project: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
};
|
|
19
|
+
readonly enabled: {
|
|
20
|
+
readonly type: "boolean";
|
|
21
|
+
};
|
|
22
|
+
readonly stale: {
|
|
23
|
+
readonly type: "boolean";
|
|
24
|
+
};
|
|
25
|
+
readonly impressionData: {
|
|
26
|
+
readonly type: "boolean";
|
|
27
|
+
};
|
|
28
|
+
readonly createdAt: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly format: "date";
|
|
31
|
+
readonly nullable: true;
|
|
32
|
+
};
|
|
33
|
+
readonly lastSeenAt: {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly format: "date";
|
|
36
|
+
readonly nullable: true;
|
|
37
|
+
};
|
|
38
|
+
readonly strategies: {
|
|
39
|
+
readonly type: "array";
|
|
40
|
+
readonly items: {
|
|
41
|
+
readonly $ref: "#/components/schemas/strategySchema";
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
readonly variants: {
|
|
45
|
+
readonly items: {
|
|
46
|
+
readonly $ref: "#/components/schemas/variantSchema";
|
|
47
|
+
};
|
|
48
|
+
readonly type: "array";
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export declare type FeatureSchema = CreateSchemaType<typeof schema>;
|
|
53
|
+
export declare const featureSchema: import("../../types/mutable").DeepMutable<{
|
|
54
|
+
readonly type: "object";
|
|
55
|
+
readonly additionalProperties: false;
|
|
56
|
+
readonly required: readonly ["name", "project"];
|
|
57
|
+
readonly properties: {
|
|
58
|
+
readonly name: {
|
|
59
|
+
readonly type: "string";
|
|
60
|
+
};
|
|
61
|
+
readonly type: {
|
|
62
|
+
readonly type: "string";
|
|
63
|
+
};
|
|
64
|
+
readonly description: {
|
|
65
|
+
readonly type: "string";
|
|
66
|
+
};
|
|
67
|
+
readonly project: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
};
|
|
70
|
+
readonly enabled: {
|
|
71
|
+
readonly type: "boolean";
|
|
72
|
+
};
|
|
73
|
+
readonly stale: {
|
|
74
|
+
readonly type: "boolean";
|
|
75
|
+
};
|
|
76
|
+
readonly impressionData: {
|
|
77
|
+
readonly type: "boolean";
|
|
78
|
+
};
|
|
79
|
+
readonly createdAt: {
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
readonly format: "date";
|
|
82
|
+
readonly nullable: true;
|
|
83
|
+
};
|
|
84
|
+
readonly lastSeenAt: {
|
|
85
|
+
readonly type: "string";
|
|
86
|
+
readonly format: "date";
|
|
87
|
+
readonly nullable: true;
|
|
88
|
+
};
|
|
89
|
+
readonly strategies: {
|
|
90
|
+
readonly type: "array";
|
|
91
|
+
readonly items: {
|
|
92
|
+
readonly $ref: "#/components/schemas/strategySchema";
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
readonly variants: {
|
|
96
|
+
readonly items: {
|
|
97
|
+
readonly $ref: "#/components/schemas/variantSchema";
|
|
98
|
+
};
|
|
99
|
+
readonly type: "array";
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
}>;
|
|
103
|
+
export {};
|