@objectql/server 3.0.1 → 4.0.1
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/CHANGELOG.md +18 -3
- package/dist/adapters/graphql.d.ts +7 -0
- package/dist/adapters/graphql.js +8 -1
- package/dist/adapters/graphql.js.map +1 -1
- package/dist/adapters/node.d.ts +7 -0
- package/dist/adapters/node.js +7 -0
- package/dist/adapters/node.js.map +1 -1
- package/dist/adapters/rest.d.ts +7 -0
- package/dist/adapters/rest.js +7 -0
- package/dist/adapters/rest.js.map +1 -1
- package/dist/file-handler.d.ts +7 -0
- package/dist/file-handler.js +7 -0
- package/dist/file-handler.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts +7 -0
- package/dist/metadata.js +10 -3
- package/dist/metadata.js.map +1 -1
- package/dist/openapi.d.ts +7 -0
- package/dist/openapi.js +7 -0
- package/dist/openapi.js.map +1 -1
- package/dist/server.d.ts +7 -0
- package/dist/server.js +14 -2
- package/dist/server.js.map +1 -1
- package/dist/storage.d.ts +7 -0
- package/dist/storage.js +7 -0
- package/dist/storage.js.map +1 -1
- package/dist/templates.d.ts +7 -0
- package/dist/templates.js +7 -0
- package/dist/templates.js.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.js +8 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +8 -1
- package/dist/utils.js.map +1 -1
- package/jest.config.js +8 -0
- package/package.json +3 -3
- package/src/adapters/graphql.ts +9 -1
- package/src/adapters/node.ts +8 -0
- package/src/adapters/rest.ts +8 -0
- package/src/file-handler.ts +8 -0
- package/src/index.ts +8 -0
- package/src/metadata.ts +11 -3
- package/src/openapi.ts +8 -0
- package/src/server.ts +13 -2
- package/src/storage.ts +8 -0
- package/src/templates.ts +8 -0
- package/src/types.ts +8 -0
- package/src/utils.ts +8 -0
- package/test/custom-routes.test.ts +8 -0
- package/test/file-upload-integration.example.ts +8 -0
- package/test/file-validation.test.ts +8 -0
- package/test/graphql.test.ts +10 -0
- package/test/integration-example.ts +8 -0
- package/test/metadata.test.ts +8 -0
- package/test/node.test.ts +10 -0
- package/test/openapi.test.ts +8 -0
- package/test/rest-advanced.test.ts +19 -4
- package/test/rest.test.ts +96 -20
- package/test/storage.test.ts +8 -0
- package/tsconfig.tsbuildinfo +1 -1
package/dist/storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,uCAAyB;AACzB,2CAA6B;AAC7B,+CAAiC;AAEjC;;GAEG;AACH,MAAa,gBAAgB;IAIzB,YAAY,OAA6C;QACrD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAE/B,+BAA+B;QAC/B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/B,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,QAAgB,EAAE,QAAgB,EAAE,OAA4B;QACrF,kCAAkC;QAClC,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,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C;YACtC,IAAI,EAAE,IAAI,CAAC,MAAM;YACjB,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,QAAQ;YACvB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACrC,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM;SAC/B,CAAC;QAEF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAC;QAE/D,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,MAAc;QACpB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAED,YAAY,CAAC,QAAgB;QACzB,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,QAAQ,EAAE,CAAC;IACzC,CAAC;IAED,KAAK;QACD,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACJ;AA7CD,8CA6CC"}
|
package/dist/templates.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
1
8
|
export declare function getWelcomePageHtml(routes: {
|
|
2
9
|
rpc: string;
|
|
3
10
|
data: string;
|
package/dist/templates.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ObjectQL
|
|
4
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.getWelcomePageHtml = getWelcomePageHtml;
|
|
4
11
|
function getWelcomePageHtml(routes) {
|
package/dist/templates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,gDAgDC;AAhDD,SAAgB,kBAAkB,CAAC,MAAsC;IACrE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;wDA4B6C,MAAM,CAAC,GAAG;uDACX,MAAM,CAAC,IAAI;;;;;;;;;;;;;;;;;QAiB1D,CAAC;AACT,CAAC"}
|
package/dist/types.d.ts
CHANGED
package/dist/types.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* ObjectQL
|
|
4
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
3
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
10
|
exports.ErrorCode = void 0;
|
|
11
|
+
// src/types.ts
|
|
5
12
|
/**
|
|
6
13
|
* Standardized error codes for ObjectQL API
|
|
7
14
|
*/
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,eAAe
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,eAAe;AAEf;;GAEG;AACH,IAAY,SAUX;AAVD,WAAY,SAAS;IACjB,gDAAmC,CAAA;IACnC,kDAAqC,CAAA;IACrC,0CAA6B,CAAA;IAC7B,oCAAuB,CAAA;IACvB,oCAAuB,CAAA;IACvB,kCAAqB,CAAA;IACrB,8CAAiC,CAAA;IACjC,8CAAiC,CAAA;IACjC,wDAA2C,CAAA;AAC/C,CAAC,EAVW,SAAS,yBAAT,SAAS,QAUpB"}
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* ObjectQL
|
|
4
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
4
8
|
*/
|
|
5
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
10
|
exports.escapeRegexPath = escapeRegexPath;
|
|
7
11
|
exports.normalizePath = normalizePath;
|
|
12
|
+
/**
|
|
13
|
+
* Utility functions for server operations
|
|
14
|
+
*/
|
|
8
15
|
/**
|
|
9
16
|
* Escapes special regex characters in a path string for use in RegExp
|
|
10
17
|
* @param path - The path string to escape
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAWH,0CAEC;AAOD,sCAEC;AApBD;;GAEG;AAEH;;;;GAIG;AACH,SAAgB,eAAe,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,IAAY;IACtC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;AACpD,CAAC"}
|
package/jest.config.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
module.exports = {
|
|
2
10
|
preset: 'ts-jest',
|
|
3
11
|
testEnvironment: 'node',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectql/server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "HTTP server adapter for ObjectQL - Express/NestJS compatible with GraphQL and REST API support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"objectql",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"graphql": "^16.8.1",
|
|
22
22
|
"@graphql-tools/schema": "^10.0.2",
|
|
23
23
|
"js-yaml": "^4.1.1",
|
|
24
|
-
"@objectql/core": "
|
|
25
|
-
"@objectql/types": "
|
|
24
|
+
"@objectql/core": "4.0.1",
|
|
25
|
+
"@objectql/types": "4.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/js-yaml": "^4.0.9",
|
package/src/adapters/graphql.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import { IObjectQL, ObjectConfig, FieldConfig } from '@objectql/types';
|
|
2
10
|
import { ObjectQLServer } from '../server';
|
|
3
11
|
import { ErrorCode } from '../types';
|
|
@@ -68,7 +76,7 @@ function mapFieldTypeToGraphQL(field: FieldConfig, isInput: boolean = false): Gr
|
|
|
68
76
|
case 'currency':
|
|
69
77
|
case 'percent':
|
|
70
78
|
return GraphQLFloat;
|
|
71
|
-
case '
|
|
79
|
+
case 'autonumber':
|
|
72
80
|
return GraphQLInt;
|
|
73
81
|
case 'boolean':
|
|
74
82
|
return GraphQLBoolean;
|
package/src/adapters/node.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import { IObjectQL, ApiRouteConfig, resolveApiRoutes } from '@objectql/types';
|
|
2
10
|
import { ObjectQLServer } from '../server';
|
|
3
11
|
import { ObjectQLRequest, ErrorCode, IFileStorage } from '../types';
|
package/src/adapters/rest.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import { IObjectQL, ApiRouteConfig, resolveApiRoutes } from '@objectql/types';
|
|
2
10
|
import { ObjectQLServer } from '../server';
|
|
3
11
|
import { ObjectQLRequest, ErrorCode } from '../types';
|
package/src/file-handler.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
2
10
|
import { IFileStorage, AttachmentData, ErrorCode } from './types';
|
|
3
11
|
import { IObjectQL, FieldConfig } from '@objectql/types';
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
export * from './types';
|
|
2
10
|
export * from './utils';
|
|
3
11
|
export * from './openapi';
|
package/src/metadata.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import { IObjectQL, ApiRouteConfig, resolveApiRoutes } from '@objectql/types';
|
|
2
10
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
11
|
import { ErrorCode } from './types';
|
|
@@ -189,9 +197,9 @@ export function createMetadataHandler(app: IObjectQL, options?: MetadataHandlerO
|
|
|
189
197
|
options: field.options,
|
|
190
198
|
min: field.min,
|
|
191
199
|
max: field.max,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
200
|
+
minLength: field.minLength,
|
|
201
|
+
maxLength: field.maxLength,
|
|
202
|
+
validation: field.validation
|
|
195
203
|
});
|
|
196
204
|
}
|
|
197
205
|
|
package/src/openapi.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import { IObjectQL, ObjectConfig, FieldConfig, ApiRouteConfig, resolveApiRoutes } from '@objectql/types';
|
|
2
10
|
|
|
3
11
|
interface OpenAPISchema {
|
package/src/server.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import { IObjectQL, ObjectQLContext } from '@objectql/types';
|
|
2
10
|
import { ObjectQLRequest, ObjectQLResponse, ErrorCode } from './types';
|
|
3
11
|
|
|
@@ -174,8 +182,11 @@ export class ObjectQLServer {
|
|
|
174
182
|
const skip = args.skip || 0;
|
|
175
183
|
const limit = args.limit || items.length;
|
|
176
184
|
|
|
177
|
-
// Get total count -
|
|
178
|
-
const
|
|
185
|
+
// Get total count - exclude limit/skip to count all matching records
|
|
186
|
+
const countArgs: any = {};
|
|
187
|
+
if (args.filters) countArgs.filters = args.filters;
|
|
188
|
+
if (args.expand) countArgs.expand = args.expand;
|
|
189
|
+
const total = await repo.count(countArgs);
|
|
179
190
|
|
|
180
191
|
const size = limit;
|
|
181
192
|
const page = limit > 0 ? Math.floor(skip / limit) + 1 : 1;
|
package/src/storage.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import { IFileStorage, AttachmentData, FileStorageOptions } from './types';
|
|
2
10
|
import * as fs from 'fs';
|
|
3
11
|
import * as path from 'path';
|
package/src/templates.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
export function getWelcomePageHtml(routes: { rpc: string; data: string; }) {
|
|
2
10
|
return `<!DOCTYPE html>
|
|
3
11
|
<html>
|
package/src/types.ts
CHANGED
package/src/utils.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* Utility functions for server operations
|
|
3
11
|
*/
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* Tests for Custom API Route Configuration
|
|
3
11
|
*
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* Integration Test Example for File Upload/Download
|
|
3
11
|
*
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import { validateFile } from '../src/file-handler';
|
|
2
10
|
import { FieldConfig } from '@objectql/types';
|
|
3
11
|
|
package/test/graphql.test.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import request from 'supertest';
|
|
2
10
|
import { createServer } from 'http';
|
|
3
11
|
import { ObjectQL } from '@objectql/core';
|
|
@@ -138,6 +146,8 @@ describe('GraphQL API Adapter', () => {
|
|
|
138
146
|
}
|
|
139
147
|
}
|
|
140
148
|
});
|
|
149
|
+
|
|
150
|
+
await app.init();
|
|
141
151
|
|
|
142
152
|
// Create handler and server once for all tests
|
|
143
153
|
handler = createGraphQLHandler(app);
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* Integration Example: Demonstrates the new standardized API response format
|
|
3
11
|
*
|
package/test/metadata.test.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import { createMetadataHandler } from '../src/metadata';
|
|
2
10
|
import { ObjectQL } from '@objectql/core';
|
|
3
11
|
import { IncomingMessage, ServerResponse } from 'http';
|
package/test/node.test.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import request from 'supertest';
|
|
2
10
|
import { createServer } from 'http';
|
|
3
11
|
import { ObjectQL } from '@objectql/core';
|
|
@@ -43,6 +51,8 @@ describe('Node Adapter', () => {
|
|
|
43
51
|
}
|
|
44
52
|
}
|
|
45
53
|
});
|
|
54
|
+
|
|
55
|
+
await app.init();
|
|
46
56
|
});
|
|
47
57
|
|
|
48
58
|
it('should handle find request', async () => {
|
package/test/openapi.test.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import { generateOpenAPI } from '../src/openapi';
|
|
2
10
|
import { ObjectQL } from '@objectql/core';
|
|
3
11
|
import { ObjectConfig } from '@objectql/types';
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectQL
|
|
3
|
+
* Copyright (c) 2026-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
import request from 'supertest';
|
|
2
10
|
import { createServer } from 'http';
|
|
3
11
|
import { ObjectQL } from '@objectql/core';
|
|
@@ -33,12 +41,12 @@ class MockDriver implements Driver {
|
|
|
33
41
|
}
|
|
34
42
|
}
|
|
35
43
|
|
|
36
|
-
// Apply skip and limit
|
|
44
|
+
// Apply skip and top/limit (QueryAST uses 'top' for limit)
|
|
37
45
|
if (query?.skip) {
|
|
38
46
|
items = items.slice(query.skip);
|
|
39
47
|
}
|
|
40
|
-
if (query?.limit) {
|
|
41
|
-
items = items.slice(0, query.limit);
|
|
48
|
+
if (query?.top || query?.limit) {
|
|
49
|
+
items = items.slice(0, query.top || query.limit);
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
return items;
|
|
@@ -79,7 +87,12 @@ class MockDriver implements Driver {
|
|
|
79
87
|
}
|
|
80
88
|
|
|
81
89
|
async count(objectName: string, query: any) {
|
|
82
|
-
|
|
90
|
+
// Count should not apply skip/limit, only filters
|
|
91
|
+
const countQuery = { ...query };
|
|
92
|
+
delete countQuery.skip;
|
|
93
|
+
delete countQuery.top;
|
|
94
|
+
delete countQuery.limit;
|
|
95
|
+
const items = await this.find(objectName, countQuery);
|
|
83
96
|
return items.length;
|
|
84
97
|
}
|
|
85
98
|
|
|
@@ -125,6 +138,8 @@ describe('REST API Error Handling & Edge Cases', () => {
|
|
|
125
138
|
}
|
|
126
139
|
}
|
|
127
140
|
});
|
|
141
|
+
|
|
142
|
+
await app.init();
|
|
128
143
|
|
|
129
144
|
handler = createRESTHandler(app);
|
|
130
145
|
server = createServer(handler);
|