@opra/core 0.7.0 → 0.8.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/cjs/adapter/adapter.js +1 -4
- package/cjs/adapter/classes/execution-context.host.js +0 -1
- package/cjs/adapter/classes/express-request-wrapper.host.js +0 -1
- package/cjs/adapter/classes/express-response-wrapper.host.js +0 -1
- package/cjs/adapter/classes/http-execution-context.host.js +0 -3
- package/cjs/adapter/classes/metadata.resource.js +0 -1
- package/cjs/adapter/request-contexts/batch-request-context.js +0 -1
- package/cjs/adapter/request-contexts/request-context.js +1 -12
- package/cjs/adapter/request-contexts/single-request-context.js +0 -1
- package/cjs/services/json-collection-service.js +1 -6
- package/cjs/services/json-singleton-service.js +0 -2
- package/esm/adapter/adapter.js +1 -4
- package/esm/adapter/classes/execution-context.host.js +0 -1
- package/esm/adapter/classes/express-request-wrapper.host.js +0 -1
- package/esm/adapter/classes/express-response-wrapper.host.js +0 -1
- package/esm/adapter/classes/http-execution-context.host.js +0 -3
- package/esm/adapter/classes/metadata.resource.js +0 -1
- package/esm/adapter/request-contexts/batch-request-context.js +0 -1
- package/esm/adapter/request-contexts/request-context.js +1 -12
- package/esm/adapter/request-contexts/single-request-context.js +0 -1
- package/esm/services/json-collection-service.js +1 -6
- package/esm/services/json-singleton-service.js +0 -2
- package/package.json +2 -3
package/cjs/adapter/adapter.js
CHANGED
|
@@ -10,12 +10,9 @@ const batch_request_context_js_1 = require("./request-contexts/batch-request-con
|
|
|
10
10
|
const single_request_context_js_1 = require("./request-contexts/single-request-context.js");
|
|
11
11
|
const noOp = () => void 0;
|
|
12
12
|
class OpraAdapter {
|
|
13
|
-
document;
|
|
14
|
-
userContextResolver;
|
|
15
|
-
_internalResources = new common_1.ResponsiveMap();
|
|
16
|
-
i18n;
|
|
17
13
|
constructor(document) {
|
|
18
14
|
this.document = document;
|
|
15
|
+
this._internalResources = new common_1.ResponsiveMap();
|
|
19
16
|
}
|
|
20
17
|
async handler(executionContext) {
|
|
21
18
|
let requestContext;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ExecutionContextHost = void 0;
|
|
4
4
|
const strict_typed_events_1 = require("strict-typed-events");
|
|
5
5
|
class ExecutionContextHost extends strict_typed_events_1.AsyncEventEmitter {
|
|
6
|
-
userContext;
|
|
7
6
|
constructor() {
|
|
8
7
|
super();
|
|
9
8
|
}
|
|
@@ -3,9 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HttpExecutionContextHost = void 0;
|
|
4
4
|
const execution_context_host_js_1 = require("./execution-context.host.js");
|
|
5
5
|
class HttpExecutionContextHost extends execution_context_host_js_1.ExecutionContextHost {
|
|
6
|
-
_platform;
|
|
7
|
-
_request;
|
|
8
|
-
_response;
|
|
9
6
|
constructor(_platform, _request, _response) {
|
|
10
7
|
super();
|
|
11
8
|
this._platform = _platform;
|
|
@@ -5,7 +5,6 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const common_1 = require("@opra/common");
|
|
6
6
|
const json_singleton_service_js_1 = require("../../services/json-singleton-service.js");
|
|
7
7
|
let MetadataResource = class MetadataResource {
|
|
8
|
-
service;
|
|
9
8
|
init(resource) {
|
|
10
9
|
this.service = new json_singleton_service_js_1.JsonSingletonService(resource.dataType, {
|
|
11
10
|
data: resource.document.getMetadata(true)
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BatchRequestContext = void 0;
|
|
4
4
|
const request_context_js_1 = require("./request-context.js");
|
|
5
5
|
class BatchRequestContext extends request_context_js_1.RequestContext {
|
|
6
|
-
queries;
|
|
7
6
|
constructor(args) {
|
|
8
7
|
super(args);
|
|
9
8
|
this.queries = args.queries;
|
|
@@ -3,19 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RequestContext = void 0;
|
|
4
4
|
const common_1 = require("@opra/common");
|
|
5
5
|
class RequestContext {
|
|
6
|
-
service;
|
|
7
|
-
executionContext;
|
|
8
|
-
params;
|
|
9
|
-
headers;
|
|
10
|
-
contentId;
|
|
11
|
-
parentValue;
|
|
12
|
-
resultPath;
|
|
13
|
-
responseHeaders;
|
|
14
|
-
response;
|
|
15
|
-
errors = [];
|
|
16
|
-
status;
|
|
17
|
-
continueOnError;
|
|
18
6
|
constructor(args) {
|
|
7
|
+
this.errors = [];
|
|
19
8
|
this.service = args.service;
|
|
20
9
|
this.executionContext = args.executionContext;
|
|
21
10
|
this.params = this.params || new common_1.OpraURLSearchParams();
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SingleRequestContext = void 0;
|
|
4
4
|
const request_context_js_1 = require("./request-context.js");
|
|
5
5
|
class SingleRequestContext extends request_context_js_1.RequestContext {
|
|
6
|
-
query;
|
|
7
6
|
constructor(args) {
|
|
8
7
|
super(args);
|
|
9
8
|
this.query = args.query;
|
|
@@ -9,14 +9,9 @@ const common_1 = require("@opra/common");
|
|
|
9
9
|
let dbId = 1;
|
|
10
10
|
const indexingTypes = ['int', 'float', 'number', 'date', 'string'];
|
|
11
11
|
class JsonCollectionService {
|
|
12
|
-
resource;
|
|
13
|
-
_status = '';
|
|
14
|
-
_initError;
|
|
15
|
-
_dbName;
|
|
16
|
-
_initData;
|
|
17
|
-
defaultLimit;
|
|
18
12
|
constructor(resource, options) {
|
|
19
13
|
this.resource = resource;
|
|
14
|
+
this._status = '';
|
|
20
15
|
if (this.resource.keyFields.length > 1)
|
|
21
16
|
throw new TypeError('JsonDataService currently doesn\'t support multiple primary keys');
|
|
22
17
|
this.defaultLimit = options?.defaultLimit ?? 10;
|
package/esm/adapter/adapter.js
CHANGED
|
@@ -7,12 +7,9 @@ import { BatchRequestContext } from './request-contexts/batch-request-context.js
|
|
|
7
7
|
import { SingleRequestContext } from './request-contexts/single-request-context.js';
|
|
8
8
|
const noOp = () => void 0;
|
|
9
9
|
export class OpraAdapter {
|
|
10
|
-
document;
|
|
11
|
-
userContextResolver;
|
|
12
|
-
_internalResources = new ResponsiveMap();
|
|
13
|
-
i18n;
|
|
14
10
|
constructor(document) {
|
|
15
11
|
this.document = document;
|
|
12
|
+
this._internalResources = new ResponsiveMap();
|
|
16
13
|
}
|
|
17
14
|
async handler(executionContext) {
|
|
18
15
|
let requestContext;
|
|
@@ -2,7 +2,6 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { OprSingletonResource } from '@opra/common';
|
|
3
3
|
import { JsonSingletonService } from '../../services/json-singleton-service.js';
|
|
4
4
|
let MetadataResource = class MetadataResource {
|
|
5
|
-
service;
|
|
6
5
|
init(resource) {
|
|
7
6
|
this.service = new JsonSingletonService(resource.dataType, {
|
|
8
7
|
data: resource.document.getMetadata(true)
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import { OpraURLSearchParams } from '@opra/common';
|
|
2
2
|
export class RequestContext {
|
|
3
|
-
service;
|
|
4
|
-
executionContext;
|
|
5
|
-
params;
|
|
6
|
-
headers;
|
|
7
|
-
contentId;
|
|
8
|
-
parentValue;
|
|
9
|
-
resultPath;
|
|
10
|
-
responseHeaders;
|
|
11
|
-
response;
|
|
12
|
-
errors = [];
|
|
13
|
-
status;
|
|
14
|
-
continueOnError;
|
|
15
3
|
constructor(args) {
|
|
4
|
+
this.errors = [];
|
|
16
5
|
this.service = args.service;
|
|
17
6
|
this.executionContext = args.executionContext;
|
|
18
7
|
this.params = this.params || new OpraURLSearchParams();
|
|
@@ -5,14 +5,9 @@ import { ArrayExpression, BadRequestError, BooleanLiteral, CollectionResourceInf
|
|
|
5
5
|
let dbId = 1;
|
|
6
6
|
const indexingTypes = ['int', 'float', 'number', 'date', 'string'];
|
|
7
7
|
export class JsonCollectionService {
|
|
8
|
-
resource;
|
|
9
|
-
_status = '';
|
|
10
|
-
_initError;
|
|
11
|
-
_dbName;
|
|
12
|
-
_initData;
|
|
13
|
-
defaultLimit;
|
|
14
8
|
constructor(resource, options) {
|
|
15
9
|
this.resource = resource;
|
|
10
|
+
this._status = '';
|
|
16
11
|
if (this.resource.keyFields.length > 1)
|
|
17
12
|
throw new TypeError('JsonDataService currently doesn\'t support multiple primary keys');
|
|
18
13
|
this.defaultLimit = options?.defaultLimit ?? 10;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Opra schema package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@nano-sql/core": "^2.3.7",
|
|
31
|
-
"@opra/common": "^0.
|
|
32
|
-
"@opra/optionals": "^0.7.0",
|
|
31
|
+
"@opra/common": "^0.8.0",
|
|
33
32
|
"body-parser": "^1.20.1",
|
|
34
33
|
"dicer": "^0.3.1",
|
|
35
34
|
"express": "^4.18.2",
|