@etohq/framework 1.0.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 +0 -0
- package/dist/build-tools/compiler.d.ts +49 -0
- package/dist/build-tools/compiler.d.ts.map +1 -0
- package/dist/build-tools/compiler.js +291 -0
- package/dist/build-tools/compiler.js.map +1 -0
- package/dist/build-tools/index.d.ts +2 -0
- package/dist/build-tools/index.d.ts.map +1 -0
- package/dist/build-tools/index.js +18 -0
- package/dist/build-tools/index.js.map +1 -0
- package/dist/config/config.d.ts +34 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +132 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +21 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +11 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +35 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/types.d.ts +901 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +3 -0
- package/dist/config/types.js.map +1 -0
- package/dist/container.d.ts +3 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/container.js +21 -0
- package/dist/container.js.map +1 -0
- package/dist/database/index.d.ts +3 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +19 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/pg-connection-loader.d.ts +6 -0
- package/dist/database/pg-connection-loader.d.ts.map +1 -0
- package/dist/database/pg-connection-loader.js +37 -0
- package/dist/database/pg-connection-loader.js.map +1 -0
- package/dist/eto-app-loader.d.ts +51 -0
- package/dist/eto-app-loader.d.ts.map +1 -0
- package/dist/eto-app-loader.js +183 -0
- package/dist/eto-app-loader.js.map +1 -0
- package/dist/feature-flags/feature-flag-loader.d.ts +8 -0
- package/dist/feature-flags/feature-flag-loader.d.ts.map +1 -0
- package/dist/feature-flags/feature-flag-loader.js +81 -0
- package/dist/feature-flags/feature-flag-loader.js.map +1 -0
- package/dist/feature-flags/flag-router.d.ts +32 -0
- package/dist/feature-flags/flag-router.d.ts.map +1 -0
- package/dist/feature-flags/flag-router.js +67 -0
- package/dist/feature-flags/flag-router.js.map +1 -0
- package/dist/feature-flags/index.d.ts +5 -0
- package/dist/feature-flags/index.d.ts.map +1 -0
- package/dist/feature-flags/index.js +21 -0
- package/dist/feature-flags/index.js.map +1 -0
- package/dist/feature-flags/types.d.ts +31 -0
- package/dist/feature-flags/types.d.ts.map +1 -0
- package/dist/feature-flags/types.js +3 -0
- package/dist/feature-flags/types.js.map +1 -0
- package/dist/http/express-loader.d.ts +8 -0
- package/dist/http/express-loader.d.ts.map +1 -0
- package/dist/http/express-loader.js +85 -0
- package/dist/http/express-loader.js.map +1 -0
- package/dist/http/index.d.ts +15 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +31 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/middlewares/apply-default-filters.d.ts +3 -0
- package/dist/http/middlewares/apply-default-filters.d.ts.map +1 -0
- package/dist/http/middlewares/apply-default-filters.js +32 -0
- package/dist/http/middlewares/apply-default-filters.js.map +1 -0
- package/dist/http/middlewares/apply-params-as-filters.d.ts +5 -0
- package/dist/http/middlewares/apply-params-as-filters.d.ts.map +1 -0
- package/dist/http/middlewares/apply-params-as-filters.js +14 -0
- package/dist/http/middlewares/apply-params-as-filters.js.map +1 -0
- package/dist/http/middlewares/authenticate-middleware.d.ts +11 -0
- package/dist/http/middlewares/authenticate-middleware.d.ts.map +1 -0
- package/dist/http/middlewares/authenticate-middleware.js +135 -0
- package/dist/http/middlewares/authenticate-middleware.js.map +1 -0
- package/dist/http/middlewares/clear-filters-by-key.d.ts +3 -0
- package/dist/http/middlewares/clear-filters-by-key.d.ts.map +1 -0
- package/dist/http/middlewares/clear-filters-by-key.js +12 -0
- package/dist/http/middlewares/clear-filters-by-key.js.map +1 -0
- package/dist/http/middlewares/ensure-publishable-api-key.d.ts +3 -0
- package/dist/http/middlewares/ensure-publishable-api-key.d.ts.map +1 -0
- package/dist/http/middlewares/ensure-publishable-api-key.js +49 -0
- package/dist/http/middlewares/ensure-publishable-api-key.js.map +1 -0
- package/dist/http/middlewares/error-handler.d.ts +23 -0
- package/dist/http/middlewares/error-handler.d.ts.map +1 -0
- package/dist/http/middlewares/error-handler.js +85 -0
- package/dist/http/middlewares/error-handler.js.map +1 -0
- package/dist/http/middlewares/exception-formatter.d.ts +9 -0
- package/dist/http/middlewares/exception-formatter.d.ts.map +1 -0
- package/dist/http/middlewares/exception-formatter.js +36 -0
- package/dist/http/middlewares/exception-formatter.js.map +1 -0
- package/dist/http/middlewares/index.d.ts +8 -0
- package/dist/http/middlewares/index.d.ts.map +1 -0
- package/dist/http/middlewares/index.js +24 -0
- package/dist/http/middlewares/index.js.map +1 -0
- package/dist/http/middlewares/set-context.d.ts +3 -0
- package/dist/http/middlewares/set-context.d.ts.map +1 -0
- package/dist/http/middlewares/set-context.js +18 -0
- package/dist/http/middlewares/set-context.js.map +1 -0
- package/dist/http/router.d.ts +100 -0
- package/dist/http/router.d.ts.map +1 -0
- package/dist/http/router.js +764 -0
- package/dist/http/router.js.map +1 -0
- package/dist/http/types.d.ts +141 -0
- package/dist/http/types.d.ts.map +1 -0
- package/dist/http/types.js +16 -0
- package/dist/http/types.js.map +1 -0
- package/dist/http/utils/define-middlewares.d.ts +18 -0
- package/dist/http/utils/define-middlewares.d.ts.map +1 -0
- package/dist/http/utils/define-middlewares.js +40 -0
- package/dist/http/utils/define-middlewares.js.map +1 -0
- package/dist/http/utils/get-query-config.d.ts +42 -0
- package/dist/http/utils/get-query-config.d.ts.map +1 -0
- package/dist/http/utils/get-query-config.js +183 -0
- package/dist/http/utils/get-query-config.js.map +1 -0
- package/dist/http/utils/http-compression.d.ts +5 -0
- package/dist/http/utils/http-compression.d.ts.map +1 -0
- package/dist/http/utils/http-compression.js +33 -0
- package/dist/http/utils/http-compression.js.map +1 -0
- package/dist/http/utils/maybe-apply-link-filter.d.ts +8 -0
- package/dist/http/utils/maybe-apply-link-filter.d.ts.map +1 -0
- package/dist/http/utils/maybe-apply-link-filter.js +71 -0
- package/dist/http/utils/maybe-apply-link-filter.js.map +1 -0
- package/dist/http/utils/refetch-entities.d.ts +5 -0
- package/dist/http/utils/refetch-entities.d.ts.map +1 -0
- package/dist/http/utils/refetch-entities.js +29 -0
- package/dist/http/utils/refetch-entities.js.map +1 -0
- package/dist/http/utils/restricted-fields.d.ts +6 -0
- package/dist/http/utils/restricted-fields.d.ts.map +1 -0
- package/dist/http/utils/restricted-fields.js +30 -0
- package/dist/http/utils/restricted-fields.js.map +1 -0
- package/dist/http/utils/unless-path.d.ts +9 -0
- package/dist/http/utils/unless-path.d.ts.map +1 -0
- package/dist/http/utils/unless-path.js +19 -0
- package/dist/http/utils/unless-path.js.map +1 -0
- package/dist/http/utils/validate-body.d.ts +5 -0
- package/dist/http/utils/validate-body.d.ts.map +1 -0
- package/dist/http/utils/validate-body.js +23 -0
- package/dist/http/utils/validate-body.js.map +1 -0
- package/dist/http/utils/validate-query.d.ts +6 -0
- package/dist/http/utils/validate-query.d.ts.map +1 -0
- package/dist/http/utils/validate-query.js +79 -0
- package/dist/http/utils/validate-query.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs/index.d.ts +2 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +18 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/job-loader.d.ts +37 -0
- package/dist/jobs/job-loader.d.ts.map +1 -0
- package/dist/jobs/job-loader.js +130 -0
- package/dist/jobs/job-loader.js.map +1 -0
- package/dist/links/index.d.ts +2 -0
- package/dist/links/index.d.ts.map +1 -0
- package/dist/links/index.js +18 -0
- package/dist/links/index.js.map +1 -0
- package/dist/links/link-loader.d.ts +10 -0
- package/dist/links/link-loader.d.ts.map +1 -0
- package/dist/links/link-loader.js +74 -0
- package/dist/links/link-loader.js.map +1 -0
- package/dist/logger/index.d.ts +3 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +9 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/mikro-orm-cli/bin.d.ts +14 -0
- package/dist/mikro-orm-cli/bin.d.ts.map +1 -0
- package/dist/mikro-orm-cli/bin.js +54 -0
- package/dist/mikro-orm-cli/bin.js.map +1 -0
- package/dist/modules-sdk/index.d.ts +2 -0
- package/dist/modules-sdk/index.d.ts.map +1 -0
- package/dist/modules-sdk/index.js +18 -0
- package/dist/modules-sdk/index.js.map +1 -0
- package/dist/orchestration/index.d.ts +2 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +18 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/subscribers/index.d.ts +3 -0
- package/dist/subscribers/index.d.ts.map +1 -0
- package/dist/subscribers/index.js +19 -0
- package/dist/subscribers/index.js.map +1 -0
- package/dist/subscribers/subscriber-loader.d.ts +11 -0
- package/dist/subscribers/subscriber-loader.d.ts.map +1 -0
- package/dist/subscribers/subscriber-loader.js +196 -0
- package/dist/subscribers/subscriber-loader.js.map +1 -0
- package/dist/subscribers/types.d.ts +15 -0
- package/dist/subscribers/types.d.ts.map +1 -0
- package/dist/subscribers/types.js +3 -0
- package/dist/subscribers/types.js.map +1 -0
- package/dist/telemetry/index.d.ts +50 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +81 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/types/container.d.ts +62 -0
- package/dist/types/container.d.ts.map +1 -0
- package/dist/types/container.js +3 -0
- package/dist/types/container.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/workflows/index.d.ts +3 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +19 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/workflow-loader.d.ts +10 -0
- package/dist/workflows/workflow-loader.d.ts.map +1 -0
- package/dist/workflows/workflow-loader.js +74 -0
- package/dist/workflows/workflow-loader.js.map +1 -0
- package/dist/workflows-sdk/composer.d.ts +2 -0
- package/dist/workflows-sdk/composer.d.ts.map +1 -0
- package/dist/workflows-sdk/composer.js +18 -0
- package/dist/workflows-sdk/composer.js.map +1 -0
- package/dist/workflows-sdk/index.d.ts +3 -0
- package/dist/workflows-sdk/index.d.ts.map +1 -0
- package/dist/workflows-sdk/index.js +19 -0
- package/dist/workflows-sdk/index.js.map +1 -0
- package/dist/zod/index.d.ts +2 -0
- package/dist/zod/index.d.ts.map +1 -0
- package/dist/zod/index.js +18 -0
- package/dist/zod/index.js.map +1 -0
- package/dist/zod/zod-helpers.d.ts +3 -0
- package/dist/zod/zod-helpers.d.ts.map +1 -0
- package/dist/zod/zod-helpers.js +95 -0
- package/dist/zod/zod-helpers.js.map +1 -0
- package/package.json +120 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maybeApplyLinkFilter = maybeApplyLinkFilter;
|
|
4
|
+
const utils_1 = require("@etohq/utils");
|
|
5
|
+
function maybeApplyLinkFilter({ entryPoint, resourceId, filterableField, filterByField = "id", }) {
|
|
6
|
+
return async function linkFilter(req, _, next) {
|
|
7
|
+
const filterableFields = req.filterableFields;
|
|
8
|
+
if (!filterableFields?.[filterableField]) {
|
|
9
|
+
return next();
|
|
10
|
+
}
|
|
11
|
+
const filterFields = filterableFields[filterableField];
|
|
12
|
+
const idsToFilterBy = Array.isArray(filterFields)
|
|
13
|
+
? filterFields
|
|
14
|
+
: [filterFields];
|
|
15
|
+
delete filterableFields[filterableField];
|
|
16
|
+
const remoteQuery = req.scope.resolve(utils_1.ContainerRegistrationKeys.REMOTE_QUERY);
|
|
17
|
+
const queryObject = (0, utils_1.remoteQueryObjectFromString)({
|
|
18
|
+
entryPoint,
|
|
19
|
+
fields: [resourceId],
|
|
20
|
+
variables: { filters: { [filterableField]: idsToFilterBy } },
|
|
21
|
+
});
|
|
22
|
+
const resources = await remoteQuery(queryObject);
|
|
23
|
+
let existingFilters = filterableFields[filterByField];
|
|
24
|
+
if (existingFilters) {
|
|
25
|
+
if (typeof existingFilters === "string") {
|
|
26
|
+
existingFilters = [existingFilters];
|
|
27
|
+
}
|
|
28
|
+
filterableFields[filterByField] = (0, utils_1.arrayIntersection)(existingFilters, resources.map((p) => p[resourceId]));
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
filterableFields[filterByField] = resources.map((p) => p[resourceId]);
|
|
32
|
+
}
|
|
33
|
+
req.filterableFields = transformFilterableFields(filterableFields);
|
|
34
|
+
return next();
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/*
|
|
38
|
+
Transforms an object key string into nested objects
|
|
39
|
+
before = {
|
|
40
|
+
"test.something.another": []
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
after = {
|
|
44
|
+
test: {
|
|
45
|
+
something: {
|
|
46
|
+
another: []
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
*/
|
|
51
|
+
function transformFilterableFields(filterableFields) {
|
|
52
|
+
const result = {};
|
|
53
|
+
for (const key of Object.keys(filterableFields)) {
|
|
54
|
+
const value = filterableFields[key];
|
|
55
|
+
const keys = key.split(".");
|
|
56
|
+
let current = result;
|
|
57
|
+
// Iterate over the keys, creating nested objects as needed
|
|
58
|
+
for (let i = 0; i < keys.length; i++) {
|
|
59
|
+
const part = keys[i];
|
|
60
|
+
current[part] ??= {};
|
|
61
|
+
if (i === keys.length - 1) {
|
|
62
|
+
// If its the last key, assign the value
|
|
63
|
+
current[part] = value;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
current = current[part];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=maybe-apply-link-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maybe-apply-link-filter.js","sourceRoot":"","sources":["../../../src/http/utils/maybe-apply-link-filter.ts"],"names":[],"mappings":";;AAOA,oDA0DC;AAjED,wCAIqB;AAGrB,SAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,UAAU,EACV,eAAe,EACf,aAAa,GAAG,IAAI,GACrB;IACC,OAAO,KAAK,UAAU,UAAU,CAC9B,GAAe,EACf,CAAC,EACD,IAAqB;QAErB,MAAM,gBAAgB,GAAG,GAAG,CAAC,gBAAgB,CAAA;QAE7C,IAAI,CAAC,gBAAgB,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;YACzC,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;QAED,MAAM,YAAY,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAA;QAEtD,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;YAC/C,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,CAAC,YAAY,CAAC,CAAA;QAElB,OAAO,gBAAgB,CAAC,eAAe,CAAC,CAAA;QAExC,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CACnC,iCAAyB,CAAC,YAAY,CACvC,CAAA;QAED,MAAM,WAAW,GAAG,IAAA,mCAA2B,EAAC;YAC9C,UAAU;YACV,MAAM,EAAE,CAAC,UAAU,CAAC;YACpB,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,aAAa,EAAE,EAAE;SAC7D,CAAC,CAAA;QAEF,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,WAAW,C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KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,wCAAwC;gBACxC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;gBACrB,MAAK;YACP,CAAC;YAED,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { EtoContainer } from "@etohq/types";
|
|
2
|
+
import { EtoRequest } from "../types";
|
|
3
|
+
export declare const refetchEntities: (entryPoint: string, idOrFilter: string | object, scope: EtoContainer, fields: string[], pagination?: EtoRequest["queryConfig"]["pagination"]) => Promise<any>;
|
|
4
|
+
export declare const refetchEntity: (entryPoint: string, idOrFilter: string | object, scope: EtoContainer, fields: string[]) => Promise<any>;
|
|
5
|
+
//# sourceMappingURL=refetch-entities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refetch-entities.d.ts","sourceRoot":"","sources":["../../../src/http/utils/refetch-entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAM3C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,eAAO,MAAM,eAAe,eACd,MAAM,cACN,MAAM,GAAG,MAAM,SACpB,YAAY,UACX,MAAM,EAAE,eACH,UAAU,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,iBAuBrD,CAAA;AAED,eAAO,MAAM,aAAa,eACZ,MAAM,cACN,MAAM,GAAG,MAAM,SACpB,YAAY,UACX,MAAM,EAAE,iBAKjB,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refetchEntity = exports.refetchEntities = void 0;
|
|
4
|
+
const utils_1 = require("@etohq/utils");
|
|
5
|
+
const refetchEntities = async (entryPoint, idOrFilter, scope, fields, pagination) => {
|
|
6
|
+
const remoteQuery = scope.resolve(utils_1.ContainerRegistrationKeys.REMOTE_QUERY);
|
|
7
|
+
const filters = (0, utils_1.isString)(idOrFilter) ? { id: idOrFilter } : idOrFilter;
|
|
8
|
+
let context = {};
|
|
9
|
+
if ("context" in filters) {
|
|
10
|
+
if (filters.context) {
|
|
11
|
+
context = filters.context;
|
|
12
|
+
}
|
|
13
|
+
delete filters.context;
|
|
14
|
+
}
|
|
15
|
+
const variables = { filters, ...context, ...pagination };
|
|
16
|
+
const queryObject = (0, utils_1.remoteQueryObjectFromString)({
|
|
17
|
+
entryPoint,
|
|
18
|
+
variables,
|
|
19
|
+
fields,
|
|
20
|
+
});
|
|
21
|
+
return await remoteQuery(queryObject);
|
|
22
|
+
};
|
|
23
|
+
exports.refetchEntities = refetchEntities;
|
|
24
|
+
const refetchEntity = async (entryPoint, idOrFilter, scope, fields) => {
|
|
25
|
+
const [entity] = await (0, exports.refetchEntities)(entryPoint, idOrFilter, scope, fields);
|
|
26
|
+
return entity;
|
|
27
|
+
};
|
|
28
|
+
exports.refetchEntity = refetchEntity;
|
|
29
|
+
//# sourceMappingURL=refetch-entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refetch-entities.js","sourceRoot":"","sources":["../../../src/http/utils/refetch-entities.ts"],"names":[],"mappings":";;;AACA,wCAIqB;AAGd,MAAM,eAAe,GAAG,KAAK,EAClC,UAAkB,EAClB,UAA2B,EAC3B,KAAmB,EACnB,MAAgB,EAChB,UAAoD,EACpD,EAAE;IACF,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,iCAAyB,CAAC,YAAY,CAAC,CAAA;IACzE,MAAM,OAAO,GAAG,IAAA,gBAAQ,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CAAA;IACtE,IAAI,OAAO,GAAW,EAAE,CAAA;IAExB,IAAI,SAAS,IAAI,OAAO,EAAE,CAAC;QACzB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,GAAG,OAAO,CAAC,OAAQ,CAAA;QAC5B,CAAC;QAED,OAAO,OAAO,CAAC,OAAO,CAAA;IACxB,CAAC;IAED,MAAM,SAAS,GAAG,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,UAAU,EAAE,CAAA;IAExD,MAAM,WAAW,GAAG,IAAA,mCAA2B,EAAC;QAC9C,UAAU;QACV,SAAS;QACT,MAAM;KACP,CAAC,CAAA;IAEF,OAAO,MAAM,WAAW,CAAC,WAAW,CAAC,CAAA;AACvC,CAAC,CAAA;AA5BY,QAAA,eAAe,mBA4B3B;AAEM,MAAM,aAAa,GAAG,KAAK,EAChC,UAAkB,EAClB,UAA2B,EAC3B,KAAmB,EACnB,MAAgB,EAChB,EAAE;IACF,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,IAAA,uBAAe,EAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAE7E,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AATY,QAAA,aAAa,iBASzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restricted-fields.d.ts","sourceRoot":"","sources":["../../../src/http/utils/restricted-fields.ts"],"names":[],"mappings":"AAAA,qBAAa,gBAAgB;;IAU3B,IAAI;IAIJ,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE;CAGrB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
7
|
+
var _RestrictedFields_restrictedFields;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RestrictedFields = void 0;
|
|
10
|
+
class RestrictedFields {
|
|
11
|
+
constructor() {
|
|
12
|
+
/**
|
|
13
|
+
* Fields that are restricted from being selected in the response.
|
|
14
|
+
* Those fields can be allowed if specified in the allowed configuration of the query config of an end point.
|
|
15
|
+
*
|
|
16
|
+
* @type {string[]}
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
_RestrictedFields_restrictedFields.set(this, new Set());
|
|
20
|
+
}
|
|
21
|
+
list() {
|
|
22
|
+
return Array.from(__classPrivateFieldGet(this, _RestrictedFields_restrictedFields, "f"));
|
|
23
|
+
}
|
|
24
|
+
add(fields) {
|
|
25
|
+
fields.map((field) => __classPrivateFieldGet(this, _RestrictedFields_restrictedFields, "f").add(field));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.RestrictedFields = RestrictedFields;
|
|
29
|
+
_RestrictedFields_restrictedFields = new WeakMap();
|
|
30
|
+
//# sourceMappingURL=restricted-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restricted-fields.js","sourceRoot":"","sources":["../../../src/http/utils/restricted-fields.ts"],"names":[],"mappings":";;;;;;;;;AAAA,MAAa,gBAAgB;IAA7B;QACE;;;;;;WAMG;QACH,6CAAiC,IAAI,GAAG,EAAE,EAAA;IAS5C,CAAC;IAPC,IAAI;QACF,OAAO,KAAK,CAAC,IAAI,CAAC,uBAAA,IAAI,0CAAkB,CAAC,CAAA;IAC3C,CAAC;IAED,GAAG,CAAC,MAAgB;QAClB,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,uBAAA,IAAI,0CAAkB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;IAC1D,CAAC;CACF;AAjBD,4CAiBC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EtoNextFunction, EtoRequest, EtoResponse, MiddlewareFunction } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Due to how our route loader works, where we load all middlewares before routes, ambiguous routes * end up having all middlewares on different routes executed before the route handler is.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* This function allows us to skip middlewares for particular routes, so we can temporarily solve * * this without completely breaking the route loader for everyone.
|
|
7
|
+
*/
|
|
8
|
+
export declare const unlessPath: (onPath: RegExp, middleware: MiddlewareFunction) => (req: EtoRequest, res: EtoResponse, next: EtoNextFunction) => any;
|
|
9
|
+
//# sourceMappingURL=unless-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unless-path.d.ts","sourceRoot":"","sources":["../../../src/http/utils/unless-path.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACV,WAAW,EACX,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAEjB;;GAEG;AACH;;GAEG;AACH,eAAO,MAAM,UAAU,WACZ,MAAM,cAAc,kBAAkB,WACzC,UAAU,OAAO,WAAW,QAAQ,eAAe,QAMxD,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unlessPath = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Due to how our route loader works, where we load all middlewares before routes, ambiguous routes * end up having all middlewares on different routes executed before the route handler is.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* This function allows us to skip middlewares for particular routes, so we can temporarily solve * * this without completely breaking the route loader for everyone.
|
|
9
|
+
*/
|
|
10
|
+
const unlessPath = (onPath, middleware) => (req, res, next) => {
|
|
11
|
+
if (onPath.test(req.path)) {
|
|
12
|
+
return next();
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return middleware(req, res, next);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.unlessPath = unlessPath;
|
|
19
|
+
//# sourceMappingURL=unless-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unless-path.js","sourceRoot":"","sources":["../../../src/http/utils/unless-path.ts"],"names":[],"mappings":";;;AAOA;;GAEG;AACH;;GAEG;AACI,MAAM,UAAU,GACrB,CAAC,MAAc,EAAE,UAA8B,EAAE,EAAE,CACnD,CAAC,GAAe,EAAE,GAAgB,EAAE,IAAqB,EAAE,EAAE;IAC3D,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,EAAE,CAAA;IACf,CAAC;SAAM,CAAC;QACN,OAAO,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;AACH,CAAC,CAAA;AARU,QAAA,UAAU,cAQpB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { NextFunction } from "express";
|
|
3
|
+
import { EtoRequest, EtoResponse } from "../types";
|
|
4
|
+
export declare function validateAndTransformBody(zodSchema: z.ZodObject<any, any> | ((customSchema?: z.ZodOptional<z.ZodNullable<z.ZodObject<any, any>>>) => z.ZodObject<any, any> | z.ZodEffects<any, any>)): (req: EtoRequest, res: EtoResponse, next: NextFunction) => Promise<void>;
|
|
5
|
+
//# sourceMappingURL=validate-body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-body.d.ts","sourceRoot":"","sources":["../../../src/http/utils/validate-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAGlD,wBAAgB,wBAAwB,CACtC,SAAS,EACL,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GACrB,CAAC,CACC,YAAY,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,KAC/D,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GACvD,CACD,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,YAAY,KACf,OAAO,CAAC,IAAI,CAAC,CAoBjB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateAndTransformBody = validateAndTransformBody;
|
|
4
|
+
const zod_helpers_1 = require("../../zod/zod-helpers");
|
|
5
|
+
function validateAndTransformBody(zodSchema) {
|
|
6
|
+
return async function validateBody(req, _, next) {
|
|
7
|
+
try {
|
|
8
|
+
let schema;
|
|
9
|
+
if (typeof zodSchema === "function") {
|
|
10
|
+
schema = zodSchema(req.additionalDataValidator);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
schema = zodSchema;
|
|
14
|
+
}
|
|
15
|
+
req.validatedBody = await (0, zod_helpers_1.zodValidator)(schema, req.body);
|
|
16
|
+
next();
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
next(e);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=validate-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-body.js","sourceRoot":"","sources":["../../../src/http/utils/validate-body.ts"],"names":[],"mappings":";;AAKA,4DA8BC;AAhCD,uDAAoD;AAEpD,SAAgB,wBAAwB,CACtC,SAIwD;IAMxD,OAAO,KAAK,UAAU,YAAY,CAChC,GAAe,EACf,CAAc,EACd,IAAkB;QAElB,IAAI,CAAC;YACH,IAAI,MAAsD,CAAA;YAC1D,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;gBACpC,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;YACjD,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,SAAS,CAAA;YACpB,CAAC;YAED,GAAG,CAAC,aAAa,GAAG,MAAM,IAAA,0BAAY,EAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAA;YACxD,IAAI,EAAE,CAAA;QACR,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,CAAC,CAAC,CAAA;QACT,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseEntity, QueryConfig } from "@etohq/types";
|
|
2
|
+
import { NextFunction } from "express";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { EtoRequest, EtoResponse } from "../types";
|
|
5
|
+
export declare function validateAndTransformQuery<TEntity extends BaseEntity>(zodSchema: z.ZodObject<any, any> | z.ZodEffects<any, any>, queryConfig: QueryConfig<TEntity>): (req: EtoRequest, res: EtoResponse, next: NextFunction) => Promise<void>;
|
|
6
|
+
//# sourceMappingURL=validate-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-query.d.ts","sourceRoot":"","sources":["../../../src/http/utils/validate-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAsB,MAAM,cAAc,CAAA;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAiDlD,wBAAgB,yBAAyB,CAAC,OAAO,SAAS,UAAU,EAClE,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EACzD,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,GAChC,CACD,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,YAAY,KACf,OAAO,CAAC,IAAI,CAAC,CAuCjB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateAndTransformQuery = validateAndTransformQuery;
|
|
4
|
+
const utils_1 = require("@etohq/utils");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const zod_helpers_1 = require("../../zod/zod-helpers");
|
|
7
|
+
const get_query_config_1 = require("./get-query-config");
|
|
8
|
+
/**
|
|
9
|
+
* Normalize an input query, especially from array like query params to an array type
|
|
10
|
+
* e.g: /admin/orders/?fields[]=id,status,cart_id becomes { fields: ["id", "status", "cart_id"] }
|
|
11
|
+
*
|
|
12
|
+
* We only support up to 2 levels of depth for query params in order to have a somewhat readable query param, and limit possible performance issues
|
|
13
|
+
*/
|
|
14
|
+
const normalizeQuery = (req) => {
|
|
15
|
+
return Object.entries(req.query).reduce((acc, [key, val]) => {
|
|
16
|
+
let normalizedValue = val;
|
|
17
|
+
if (Array.isArray(val) && val.length === 1 && typeof val[0] === "string") {
|
|
18
|
+
normalizedValue = val[0].split(",");
|
|
19
|
+
}
|
|
20
|
+
if (key.includes(".")) {
|
|
21
|
+
const [parent, child, ...others] = key.split(".");
|
|
22
|
+
if (others.length > 0) {
|
|
23
|
+
throw new utils_1.EtoError(utils_1.EtoError.Types.INVALID_ARGUMENT, `Key accessor more than 2 levels deep: ${key}`);
|
|
24
|
+
}
|
|
25
|
+
if (!acc[parent]) {
|
|
26
|
+
acc[parent] = {};
|
|
27
|
+
}
|
|
28
|
+
acc[parent] = {
|
|
29
|
+
...acc[parent],
|
|
30
|
+
[child]: normalizedValue,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
acc[key] = normalizedValue;
|
|
35
|
+
}
|
|
36
|
+
return acc;
|
|
37
|
+
}, {});
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Omit the non filterable config from the validated object
|
|
41
|
+
* @param obj
|
|
42
|
+
*/
|
|
43
|
+
const getFilterableFields = (obj) => {
|
|
44
|
+
const result = (0, lodash_1.omit)(obj, ["limit", "offset", "fields", "order"]);
|
|
45
|
+
return (0, utils_1.removeUndefinedProperties)(result);
|
|
46
|
+
};
|
|
47
|
+
function validateAndTransformQuery(zodSchema, queryConfig) {
|
|
48
|
+
return async function validateQuery(req, _, next) {
|
|
49
|
+
try {
|
|
50
|
+
const restricted = req.restrictedFields?.list();
|
|
51
|
+
const allowed = queryConfig.allowed ?? [];
|
|
52
|
+
// If any custom allowed fields are set, we add them to the allowed list along side the one configured in the query config if any
|
|
53
|
+
if (req.allowed?.length) {
|
|
54
|
+
allowed.push(...req.allowed);
|
|
55
|
+
}
|
|
56
|
+
delete req.allowed;
|
|
57
|
+
const query = normalizeQuery(req);
|
|
58
|
+
const validated = await (0, zod_helpers_1.zodValidator)(zodSchema, query);
|
|
59
|
+
const cnf = queryConfig.isList
|
|
60
|
+
? (0, get_query_config_1.prepareListQuery)(validated, { ...queryConfig, allowed, restricted })
|
|
61
|
+
: (0, get_query_config_1.prepareRetrieveQuery)(validated, {
|
|
62
|
+
...queryConfig,
|
|
63
|
+
allowed,
|
|
64
|
+
restricted,
|
|
65
|
+
});
|
|
66
|
+
req.validatedQuery = validated;
|
|
67
|
+
req.filterableFields = getFilterableFields(req.validatedQuery);
|
|
68
|
+
req.queryConfig = cnf.remoteQueryConfig;
|
|
69
|
+
req.remoteQueryConfig = req.queryConfig;
|
|
70
|
+
req.listConfig = cnf.listConfig;
|
|
71
|
+
req.retrieveConfig = cnf.retrieveConfig;
|
|
72
|
+
next();
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
next(e);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=validate-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-query.js","sourceRoot":"","sources":["../../../src/http/utils/validate-query.ts"],"names":[],"mappings":";;AAwDA,8DA8CC;AArGD,wCAAkE;AAElE,mCAA6B;AAG7B,uDAAoD;AAEpD,yDAA2E;AAE3E;;;;;GAKG;AACH,MAAM,cAAc,GAAG,CAAC,GAAe,EAAE,EAAE;IACzC,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE;QAC1D,IAAI,eAAe,GAAG,GAAG,CAAA;QACzB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;YACzE,eAAe,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;QAED,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACjD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtB,MAAM,IAAI,gBAAQ,CAChB,gBAAQ,CAAC,KAAK,CAAC,gBAAgB,EAC/B,yCAAyC,GAAG,EAAE,CAC/C,CAAA;YACH,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;gBACjB,GA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AA,mCAAgB,EAAC,SAAS,EAAE,EAAE,GAAG,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;gBACtE,CAAC,CAAC,IAAA,uCAAoB,EAAC,SAAS,EAAE;oBAC9B,GAAG,WAAW;oBACd,OAAO;oBACP,UAAU;iBACX,CAAC,CAAA;YAEN,GAAG,CAAC,cAAc,GAAG,SAAS,CAAA;YAC9B,GAAG,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;YAC9D,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,iBAAwB,CAAA;YAC9C,GAAG,CAAC,iBAAiB,GAAG,GAAG,CAAC,WAAW,CAAA;YACvC,GAAG,CAAC,UAAU,GAAI,GAAW,CAAC,UAAU,CAAA;YACxC,GAAG,CAAC,cAAc,GAAI,GAAW,CAAC,cAAc,CAAA;YAEhD,IAAI,EAAE,CAAA;QACR,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,CAAC,CAAC,CAAA;QACT,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./config";
|
|
2
|
+
export * from "./container";
|
|
3
|
+
export * from "./database";
|
|
4
|
+
export * from "./feature-flags";
|
|
5
|
+
export * from "./http";
|
|
6
|
+
export * from "./jobs";
|
|
7
|
+
export * from "./links";
|
|
8
|
+
export * from "./logger";
|
|
9
|
+
export * from "./eto-app-loader";
|
|
10
|
+
export * from "./subscribers";
|
|
11
|
+
export * from "./workflows";
|
|
12
|
+
export * from "./telemetry";
|
|
13
|
+
export * from "./zod";
|
|
14
|
+
export declare const ETO_CLI_PATH: string;
|
|
15
|
+
export { Query } from "@etohq/modules-sdk";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,OAAO,CAAA;AAErB,eAAO,MAAM,YAAY,QAAgC,CAAA;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Query = exports.ETO_CLI_PATH = void 0;
|
|
18
|
+
__exportStar(require("./config"), exports);
|
|
19
|
+
__exportStar(require("./container"), exports);
|
|
20
|
+
__exportStar(require("./database"), exports);
|
|
21
|
+
__exportStar(require("./feature-flags"), exports);
|
|
22
|
+
__exportStar(require("./http"), exports);
|
|
23
|
+
__exportStar(require("./jobs"), exports);
|
|
24
|
+
__exportStar(require("./links"), exports);
|
|
25
|
+
__exportStar(require("./logger"), exports);
|
|
26
|
+
__exportStar(require("./eto-app-loader"), exports);
|
|
27
|
+
__exportStar(require("./subscribers"), exports);
|
|
28
|
+
__exportStar(require("./workflows"), exports);
|
|
29
|
+
__exportStar(require("./telemetry"), exports);
|
|
30
|
+
__exportStar(require("./zod"), exports);
|
|
31
|
+
exports.ETO_CLI_PATH = require.resolve("@etohq/cli");
|
|
32
|
+
var modules_sdk_1 = require("@etohq/modules-sdk");
|
|
33
|
+
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return modules_sdk_1.Query; } });
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B;AAC1B,kDAA+B;AAC/B,yCAAsB;AACtB,yCAAsB;AACtB,0CAAuB;AACvB,2CAAwB;AACxB,mDAAgC;AAChC,gDAA6B;AAC7B,8CAA2B;AAC3B,8CAA2B;AAC3B,wCAAqB;AAER,QAAA,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;AAEzD,kDAA0C;AAAjC,oGAAA,KAAK,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/jobs/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./job-loader"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/jobs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SchedulerOptions } from "@etohq/orchestration";
|
|
2
|
+
import { EtoContainer } from "@etohq/types";
|
|
3
|
+
type CronJobConfig = {
|
|
4
|
+
name: string;
|
|
5
|
+
schedule: string;
|
|
6
|
+
numberOfExecutions?: SchedulerOptions["numberOfExecutions"];
|
|
7
|
+
};
|
|
8
|
+
type CronJobHandler = (container: EtoContainer) => Promise<any>;
|
|
9
|
+
export declare class JobLoader {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(sourceDir: string | string[]);
|
|
12
|
+
/**
|
|
13
|
+
* Validate cron job configuration
|
|
14
|
+
* @param config
|
|
15
|
+
* @protected
|
|
16
|
+
*/
|
|
17
|
+
protected validateConfig(config: {
|
|
18
|
+
schedule: string | SchedulerOptions;
|
|
19
|
+
name: string;
|
|
20
|
+
}): void;
|
|
21
|
+
/**
|
|
22
|
+
* Create a workflow to register a new cron job
|
|
23
|
+
* @param config
|
|
24
|
+
* @param handler
|
|
25
|
+
* @protected
|
|
26
|
+
*/
|
|
27
|
+
protected registerJob({ config, handler, }: {
|
|
28
|
+
config: CronJobConfig;
|
|
29
|
+
handler: CronJobHandler;
|
|
30
|
+
}): void;
|
|
31
|
+
/**
|
|
32
|
+
* Load cron jobs from one or multiple source paths
|
|
33
|
+
*/
|
|
34
|
+
load(): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=job-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-loader.d.ts","sourceRoot":"","sources":["../../src/jobs/job-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAkB3C,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,kBAAkB,CAAC,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAA;CAC5D,CAAA;AAED,KAAK,cAAc,GAAG,CAAC,SAAS,EAAE,YAAY,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;AAE/D,qBAAa,SAAS;;gBAmBR,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE;IAIxC;;;;OAIG;IACH,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE;QAC/B,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAAA;QACnC,IAAI,EAAE,MAAM,CAAA;KACb;IAuBD;;;;;OAKG;IACH,SAAS,CAAC,WAAW,CAAC,EACpB,MAAM,EACN,OAAO,GACR,EAAE;QACD,MAAM,EAAE,aAAa,CAAA;QACrB,OAAO,EAAE,cAAc,CAAA;KACxB;IAiCD;;OAEG;IACG,IAAI;CAuDX"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _JobLoader_sourceDir, _JobLoader_excludes;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.JobLoader = void 0;
|
|
16
|
+
const utils_1 = require("@etohq/utils");
|
|
17
|
+
const workflows_sdk_1 = require("@etohq/workflows-sdk");
|
|
18
|
+
const promises_1 = require("fs/promises");
|
|
19
|
+
const path_1 = require("path");
|
|
20
|
+
const logger_1 = require("../logger");
|
|
21
|
+
class JobLoader {
|
|
22
|
+
constructor(sourceDir) {
|
|
23
|
+
/**
|
|
24
|
+
* The directory from which to load the jobs
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
_JobLoader_sourceDir.set(this, void 0);
|
|
28
|
+
/**
|
|
29
|
+
* The list of file names to exclude from the subscriber scan
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
_JobLoader_excludes.set(this, [
|
|
33
|
+
/index\.js/,
|
|
34
|
+
/index\.ts/,
|
|
35
|
+
/\.DS_Store/,
|
|
36
|
+
/(\.ts\.map|\.js\.map|\.d\.ts|\.md)/,
|
|
37
|
+
/^_[^/\\]*(\.[^/\\]+)?$/,
|
|
38
|
+
]);
|
|
39
|
+
__classPrivateFieldSet(this, _JobLoader_sourceDir, sourceDir, "f");
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Validate cron job configuration
|
|
43
|
+
* @param config
|
|
44
|
+
* @protected
|
|
45
|
+
*/
|
|
46
|
+
validateConfig(config) {
|
|
47
|
+
if (!config) {
|
|
48
|
+
throw new utils_1.EtoError(utils_1.EtoError.Types.INVALID_ARGUMENT, "Config is required for scheduled jobs.");
|
|
49
|
+
}
|
|
50
|
+
if (!config.schedule) {
|
|
51
|
+
throw new utils_1.EtoError(utils_1.EtoError.Types.INVALID_ARGUMENT, "Cron schedule definition is required for scheduled jobs.");
|
|
52
|
+
}
|
|
53
|
+
if (!config.name) {
|
|
54
|
+
throw new utils_1.EtoError(utils_1.EtoError.Types.INVALID_ARGUMENT, "Job name is required for scheduled jobs.");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create a workflow to register a new cron job
|
|
59
|
+
* @param config
|
|
60
|
+
* @param handler
|
|
61
|
+
* @protected
|
|
62
|
+
*/
|
|
63
|
+
registerJob({ config, handler, }) {
|
|
64
|
+
const workflowName = `job-${config.name}`;
|
|
65
|
+
const step = (0, workflows_sdk_1.createStep)(`${config.name}-as-step`, async (_, stepContext) => {
|
|
66
|
+
const { container } = stepContext;
|
|
67
|
+
try {
|
|
68
|
+
const res = await handler(container);
|
|
69
|
+
return new workflows_sdk_1.StepResponse(res, res);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
logger_1.logger.error(`Scheduled job ${config.name} failed with error: ${error.message}`);
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const workflowConfig = {
|
|
77
|
+
name: workflowName,
|
|
78
|
+
schedule: (0, utils_1.isObject)(config.schedule)
|
|
79
|
+
? config.schedule
|
|
80
|
+
: {
|
|
81
|
+
cron: config.schedule,
|
|
82
|
+
numberOfExecutions: config.numberOfExecutions,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
(0, workflows_sdk_1.createWorkflow)(workflowConfig, () => {
|
|
86
|
+
step();
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Load cron jobs from one or multiple source paths
|
|
91
|
+
*/
|
|
92
|
+
async load() {
|
|
93
|
+
const normalizedSourcePath = Array.isArray(__classPrivateFieldGet(this, _JobLoader_sourceDir, "f"))
|
|
94
|
+
? __classPrivateFieldGet(this, _JobLoader_sourceDir, "f")
|
|
95
|
+
: [__classPrivateFieldGet(this, _JobLoader_sourceDir, "f")];
|
|
96
|
+
const promises = normalizedSourcePath.map(async (sourcePath) => {
|
|
97
|
+
try {
|
|
98
|
+
await (0, promises_1.access)(sourcePath);
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
logger_1.logger.info(`No job to load from ${sourcePath}. skipped.`);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
return await (0, utils_1.readDirRecursive)(sourcePath).then(async (entries) => {
|
|
105
|
+
const fileEntries = entries.filter((entry) => {
|
|
106
|
+
return (!entry.isDirectory() &&
|
|
107
|
+
!__classPrivateFieldGet(this, _JobLoader_excludes, "f").some((exclude) => exclude.test(entry.name)));
|
|
108
|
+
});
|
|
109
|
+
logger_1.logger.debug(`Registering jobs from ${sourcePath}.`);
|
|
110
|
+
return await (0, utils_1.promiseAll)(fileEntries.map(async (entry) => {
|
|
111
|
+
const fullPath = (0, path_1.join)(entry.path, entry.name);
|
|
112
|
+
const module_ = await (0, utils_1.dynamicImport)(fullPath);
|
|
113
|
+
const input = {
|
|
114
|
+
config: module_.config,
|
|
115
|
+
handler: module_.default,
|
|
116
|
+
};
|
|
117
|
+
this.validateConfig(input.config);
|
|
118
|
+
return input;
|
|
119
|
+
}));
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
const jobsInputs = await (0, utils_1.promiseAll)(promises);
|
|
123
|
+
const flatJobsInput = jobsInputs.flat(1).filter((job) => !!job);
|
|
124
|
+
flatJobsInput.map(this.registerJob);
|
|
125
|
+
logger_1.logger.debug(`Job registered.`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.JobLoader = JobLoader;
|
|
129
|
+
_JobLoader_sourceDir = new WeakMap(), _JobLoader_excludes = new WeakMap();
|
|
130
|
+
//# sourceMappingURL=job-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-loader.js","sourceRoot":"","sources":["../../src/jobs/job-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,wCAMqB;AACrB,wDAI6B;AAE7B,0CAAoC;AACpC,+BAA2B;AAC3B,sCAAkC;AAUlC,MAAa,SAAS;IAmBpB,YAAY,SAA4B;QAlBxC;;;WAGG;QACH,uCAA6B;QAE7B;;;WAGG;QACH,8BAAsB;YACpB,WAAW;YACX,WAAW;YACX,YAAY;YACZ,oCAAoC;YACpC,wBAAwB;SACzB,EAAA;QAGC,uBAAA,IAAI,wBAAc,SAAS,MAAA,CAAA;IAC7B,CAAC;IAED;;;;OAIG;IACO,cAAc,CAAC,MAGxB;QACC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,gBAAQ,CAChB,gBAAQ,CAAC,KAAK,CAAC,gBAAgB,EAC/B,wCAAwC,CACzC,CAAA;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,IAAI,gBAAQ,CAChB,gBAAQ,CAAC,KAAK,CAAC,gBAAgB,EAC/B,0DAA0D,CAC3D,CAAA;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,gBAAQ,CAChB,gBAAQ,CAAC,KAAK,CAAC,gBAAgB,EAC/B,0CAA0C,CAC3C,C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