quidproquo-webserver 0.0.91 → 0.0.92

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.
@@ -0,0 +1,4 @@
1
+ export declare enum AdminActionType {
2
+ GetLog = "@quidproquo-webserver/Admin/GetLog",
3
+ GetLogs = "@quidproquo-webserver/Admin/GetLogs"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdminActionType = void 0;
4
+ var AdminActionType;
5
+ (function (AdminActionType) {
6
+ AdminActionType["GetLog"] = "@quidproquo-webserver/Admin/GetLog";
7
+ AdminActionType["GetLogs"] = "@quidproquo-webserver/Admin/GetLogs";
8
+ })(AdminActionType = exports.AdminActionType || (exports.AdminActionType = {}));
@@ -0,0 +1,2 @@
1
+ import { AdminGetLogActionRequester } from './AdminGetLogActionTypes';
2
+ export declare function askAdminGetLog(correlationId: string): AdminGetLogActionRequester;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.askAdminGetLog = void 0;
4
+ const AdminActionType_1 = require("./AdminActionType");
5
+ function* askAdminGetLog(correlationId) {
6
+ return yield {
7
+ type: AdminActionType_1.AdminActionType.GetLog,
8
+ payload: {
9
+ correlationId,
10
+ },
11
+ };
12
+ }
13
+ exports.askAdminGetLog = askAdminGetLog;
@@ -0,0 +1,11 @@
1
+ import { Action, ActionProcessor, ActionRequester, StoryResult } from 'quidproquo-core';
2
+ import { AdminActionType } from './AdminActionType';
3
+ export interface AdminGetLogActionPayload {
4
+ correlationId: string;
5
+ }
6
+ export interface AdminGetLogAction extends Action<AdminGetLogActionPayload> {
7
+ type: AdminActionType.GetLog;
8
+ payload: AdminGetLogActionPayload;
9
+ }
10
+ export type AdminGetLogActionProcessor = ActionProcessor<AdminGetLogAction, StoryResult<any>>;
11
+ export type AdminGetLogActionRequester = ActionRequester<AdminGetLogAction, StoryResult<any>>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { AdminGetLogsActionRequester } from './AdminGetLogsActionTypes';
2
+ export declare function askAdminGetLogs(runtimeType: string, startIsoDateTime: string, endIsoDateTime: string, nextPageKey?: string): AdminGetLogsActionRequester;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.askAdminGetLogs = void 0;
4
+ const AdminActionType_1 = require("./AdminActionType");
5
+ function* askAdminGetLogs(runtimeType, startIsoDateTime, endIsoDateTime, nextPageKey) {
6
+ return yield {
7
+ type: AdminActionType_1.AdminActionType.GetLogs,
8
+ payload: {
9
+ runtimeType,
10
+ nextPageKey,
11
+ startIsoDateTime,
12
+ endIsoDateTime,
13
+ },
14
+ };
15
+ }
16
+ exports.askAdminGetLogs = askAdminGetLogs;
@@ -0,0 +1,18 @@
1
+ import { Action, ActionProcessor, ActionRequester, StoryResultMetadata } from 'quidproquo-core';
2
+ import { AdminActionType } from './AdminActionType';
3
+ export interface QpqLogList {
4
+ items: StoryResultMetadata[];
5
+ nextPageKey?: string;
6
+ }
7
+ export interface AdminGetLogsActionPayload {
8
+ runtimeType: string;
9
+ nextPageKey?: string;
10
+ startIsoDateTime: string;
11
+ endIsoDateTime: string;
12
+ }
13
+ export interface AdminGetLogsAction extends Action<AdminGetLogsActionPayload> {
14
+ type: AdminActionType.GetLogs;
15
+ payload: AdminGetLogsActionPayload;
16
+ }
17
+ export type AdminGetLogsActionProcessor = ActionProcessor<AdminGetLogsAction, QpqLogList>;
18
+ export type AdminGetLogsActionRequester = ActionRequester<AdminGetLogsAction, QpqLogList>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export * from './AdminActionType';
2
+ export * from './AdminGetLogActionRequester';
3
+ export * from './AdminGetLogActionTypes';
4
+ export * from './AdminGetLogsActionRequester';
5
+ export * from './AdminGetLogsActionTypes';
@@ -0,0 +1,21 @@
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("./AdminActionType"), exports);
18
+ __exportStar(require("./AdminGetLogActionRequester"), exports);
19
+ __exportStar(require("./AdminGetLogActionTypes"), exports);
20
+ __exportStar(require("./AdminGetLogsActionRequester"), exports);
21
+ __exportStar(require("./AdminGetLogsActionTypes"), exports);
@@ -1,3 +1,4 @@
1
+ export * from './admin';
1
2
  export * from './genericDataResource';
2
3
  export * from './openApiSpec';
3
4
  export * from './serviceFunction';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./admin"), exports);
17
18
  __exportStar(require("./genericDataResource"), exports);
18
19
  __exportStar(require("./openApiSpec"), exports);
19
20
  __exportStar(require("./serviceFunction"), exports);
@@ -3,6 +3,7 @@ export * from './apiKey';
3
3
  export * from './defaultRouteOptions';
4
4
  export * from './dns';
5
5
  export * from './serviceFunction';
6
+ export * from './logApi';
6
7
  export * from './openApi';
7
8
  export * from './route';
8
9
  export * from './seo';
@@ -19,6 +19,7 @@ __exportStar(require("./apiKey"), exports);
19
19
  __exportStar(require("./defaultRouteOptions"), exports);
20
20
  __exportStar(require("./dns"), exports);
21
21
  __exportStar(require("./serviceFunction"), exports);
22
+ __exportStar(require("./logApi"), exports);
22
23
  __exportStar(require("./openApi"), exports);
23
24
  __exportStar(require("./route"), exports);
24
25
  __exportStar(require("./seo"), exports);
@@ -0,0 +1,2 @@
1
+ import { QPQConfigSettings } from 'quidproquo-core';
2
+ export declare const defineLogApi: () => QPQConfigSettings;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineLogApi = void 0;
4
+ const route_1 = require("./route");
5
+ const serviceConfig_1 = require("../../utils/serviceConfig");
6
+ const defineLogApi = () => {
7
+ // comment
8
+ const configs = [
9
+ (0, route_1.defineRoute)('POST', '/log/list', (0, serviceConfig_1.getServiceEntry)('log', 'controller', 'logController'), 'getLogs'),
10
+ (0, route_1.defineRoute)('GET', '/log/{correlationId}', (0, serviceConfig_1.getServiceEntry)('log', 'controller', 'logController'), 'getLog'),
11
+ ];
12
+ return configs;
13
+ };
14
+ exports.defineLogApi = defineLogApi;
package/lib/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from './config';
3
3
  export * from './types';
4
4
  export * from './stories';
5
5
  export * from './qpqWebServerUtils';
6
+ export * from './services/serviceImporter';
package/lib/index.js CHANGED
@@ -19,3 +19,4 @@ __exportStar(require("./config"), exports);
19
19
  __exportStar(require("./types"), exports);
20
20
  __exportStar(require("./stories"), exports);
21
21
  __exportStar(require("./qpqWebServerUtils"), exports);
22
+ __exportStar(require("./services/serviceImporter"), exports);
@@ -0,0 +1,11 @@
1
+ import { HTTPEvent } from '../../../../types';
2
+ export interface GetLogsParams {
3
+ nextPageKey?: string;
4
+ startIsoDateTime: string;
5
+ endIsoDateTime: string;
6
+ runtimeType: string;
7
+ }
8
+ export declare function getLogs(event: HTTPEvent, params: {}): Generator<import("../../../../actions").AdminGetLogsAction, import("../../../../types").HTTPEventResponse<string>, import("../../../../actions").QpqLogList>;
9
+ export declare function getLog(event: HTTPEvent, params: {
10
+ correlationId: string;
11
+ }): Generator<import("../../../../actions").AdminGetLogAction, import("../../../../types").HTTPEventResponse<string>, import("quidproquo-core/lib").StoryResult<any, any>>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLog = exports.getLogs = void 0;
4
+ const httpEventUtils_1 = require("../../../../utils/httpEventUtils");
5
+ const actions_1 = require("../../../../actions");
6
+ function* getLogs(event, params) {
7
+ const { nextPageKey, startIsoDateTime, endIsoDateTime, runtimeType } = (0, httpEventUtils_1.fromJsonEventRequest)(event);
8
+ const logs = yield* (0, actions_1.askAdminGetLogs)(runtimeType, startIsoDateTime, endIsoDateTime, nextPageKey);
9
+ return (0, httpEventUtils_1.toJsonEventResponse)(logs);
10
+ }
11
+ exports.getLogs = getLogs;
12
+ function* getLog(event, params) {
13
+ const log = yield* (0, actions_1.askAdminGetLog)(params.correlationId);
14
+ return (0, httpEventUtils_1.toJsonEventResponse)(log);
15
+ }
16
+ exports.getLog = getLog;
@@ -0,0 +1 @@
1
+ export declare const serviceImporter: (modulePath: string) => Promise<any>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.serviceImporter = void 0;
13
+ const serviceConfig_1 = require("../utils/serviceConfig");
14
+ const serviceEntryMap = {
15
+ [(0, serviceConfig_1.getServiceEntry)('log', 'controller', 'logController')]: require('../services/log/entry/controller/logController'),
16
+ };
17
+ const serviceImporter = (modulePath) => __awaiter(void 0, void 0, void 0, function* () {
18
+ return serviceEntryMap[modulePath] || null;
19
+ });
20
+ exports.serviceImporter = serviceImporter;
@@ -24,9 +24,10 @@ const getAllowedOrigins = (qpqConfig, route) => {
24
24
  };
25
25
  exports.getAllowedOrigins = getAllowedOrigins;
26
26
  const getCorsHeaders = (qpqConfig, route, reqHeaders) => {
27
+ var _a;
27
28
  const origin = (0, exports.getHeaderValue)('origin', reqHeaders) || '';
28
29
  const allowedOrigins = (0, exports.getAllowedOrigins)(qpqConfig, route);
29
- const allowCredentials = Object.keys(route.routeAuthSettings || {}).length > 0;
30
+ const allowCredentials = !!((_a = route.routeAuthSettings) === null || _a === void 0 ? void 0 : _a.userDirectoryName);
30
31
  // If we have an auth endpoint, then we don't let wildcard origins access the API for security reasons
31
32
  const allowOrigin = (!allowCredentials
32
33
  ? allowedOrigins.find((ao) => origin === ao || ao === '*')
@@ -0,0 +1 @@
1
+ export declare const getServiceEntry: (serviceName: string, entryType: string, src: string) => string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getServiceEntry = void 0;
4
+ const getServiceEntry = (serviceName, entryType, src) => {
5
+ return `@QpqService/${serviceName}/entry/${entryType}/${src}`;
6
+ };
7
+ exports.getServiceEntry = getServiceEntry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-webserver",
3
- "version": "0.0.91",
3
+ "version": "0.0.92",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.js",