@objectql/types 4.0.0 → 4.0.2
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 +4 -0
- package/dist/action.d.ts +2 -1
- package/dist/api.d.ts +14 -8
- package/dist/api.js.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/driver.d.ts +6 -0
- package/dist/field.d.ts +5 -2
- package/dist/object.d.ts +1 -8
- package/dist/query.d.ts +51 -12
- package/dist/registry.d.ts +4 -4
- package/dist/registry.js +4 -4
- package/dist/registry.js.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# @objectql/types
|
|
2
2
|
|
|
3
|
+
> **Implementation Status**: ✅ **Complete** - All type definitions available. See [Implementation Status](https://github.com/objectstack-ai/objectql/blob/main/IMPLEMENTATION_STATUS.md) for runtime implementation details.
|
|
4
|
+
|
|
3
5
|
Type definitions for the ObjectQL system, including object schemas, field configurations, validation rules, queries, hooks, and actions.
|
|
4
6
|
|
|
7
|
+
> **Note**: This package defines the type system. Some types (like permissions and workflows) are defined but require application-layer implementation. See the implementation status document for details.
|
|
8
|
+
|
|
5
9
|
## Features
|
|
6
10
|
|
|
7
11
|
- **Object & Field Types**: Define data models with `ObjectConfig` and `FieldConfig`
|
package/dist/action.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import { UI } from '@objectstack/spec';
|
|
9
|
+
type Action = UI.Action;
|
|
9
10
|
import { FieldConfig } from "./field";
|
|
10
11
|
import { HookAPI } from "./hook";
|
|
11
12
|
/**
|
package/dist/api.d.ts
CHANGED
|
@@ -96,16 +96,22 @@ export interface DataApiListResponse<T = unknown> extends DataApiResponse<T> {
|
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Response for single item operations (findOne, create, update)
|
|
99
|
+
* Single item operations wrap the data in a 'data' field
|
|
99
100
|
*/
|
|
100
101
|
export interface DataApiItemResponse<T = unknown> extends DataApiResponse<T> {
|
|
101
|
-
/** The item
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
102
|
+
/** The returned item data */
|
|
103
|
+
data?: T & {
|
|
104
|
+
/** The item ID */
|
|
105
|
+
_id?: string | number;
|
|
106
|
+
/** Object type identifier */
|
|
107
|
+
'@type'?: string;
|
|
108
|
+
/** Timestamp when created */
|
|
109
|
+
created_at?: string | Date;
|
|
110
|
+
/** Timestamp when last updated */
|
|
111
|
+
updated_at?: string | Date;
|
|
112
|
+
/** Additional item fields */
|
|
113
|
+
[key: string]: unknown;
|
|
114
|
+
};
|
|
109
115
|
}
|
|
110
116
|
/**
|
|
111
117
|
* Query parameters for GET /api/data/:object (list records)
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA6jBH,4CASC;AAxjBD,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E;;GAEG;AACH,IAAY,YAUX;AAVD,WAAY,YAAY;IACpB,mDAAmC,CAAA;IACnC,qDAAqC,CAAA;IACrC,6CAA6B,CAAA;IAC7B,uCAAuB,CAAA;IACvB,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IACrB,iDAAiC,CAAA;IACjC,iDAAiC,CAAA;IACjC,2DAA2C,CAAA;AAC/C,CAAC,EAVW,YAAY,4BAAZ,YAAY,QAUvB;AAwBD;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK;IAIpC,YAAY,KAAkF;QAC1F,KA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AAC,KAAK,CAAC;KAClE,CAAC;AACN,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { MetadataRegistry } from "./registry";
|
|
9
9
|
import { Driver } from "./driver";
|
|
10
10
|
import { ObjectConfig } from "./object";
|
|
11
|
-
import type { RuntimePlugin } from "
|
|
11
|
+
import type { RuntimePlugin } from "../../../objectstack/runtime/dist";
|
|
12
12
|
export interface ObjectQLConfig {
|
|
13
13
|
registry?: MetadataRegistry;
|
|
14
14
|
datasources?: Record<string, Driver>;
|
|
@@ -37,7 +37,7 @@ export interface ObjectQLConfig {
|
|
|
37
37
|
modules?: string[];
|
|
38
38
|
/**
|
|
39
39
|
* List of plugins to load.
|
|
40
|
-
* Must implement the RuntimePlugin interface from @
|
|
40
|
+
* Must implement the RuntimePlugin interface from @objectql/runtime.
|
|
41
41
|
* String plugins (package names) are not supported in core.
|
|
42
42
|
*/
|
|
43
43
|
plugins?: (RuntimePlugin | string)[];
|
package/dist/driver.d.ts
CHANGED
|
@@ -66,6 +66,12 @@ export interface Driver {
|
|
|
66
66
|
fullTextSearch?: boolean;
|
|
67
67
|
jsonFields?: boolean;
|
|
68
68
|
arrayFields?: boolean;
|
|
69
|
+
queryFilters?: boolean;
|
|
70
|
+
queryAggregations?: boolean;
|
|
71
|
+
querySorting?: boolean;
|
|
72
|
+
queryPagination?: boolean;
|
|
73
|
+
queryWindowFunctions?: boolean;
|
|
74
|
+
querySubqueries?: boolean;
|
|
69
75
|
};
|
|
70
76
|
find(objectName: string, query: any, options?: any): Promise<any[]>;
|
|
71
77
|
findOne(objectName: string, id: string | number, query?: any, options?: any): Promise<any>;
|
package/dist/field.d.ts
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import { Data } from '@objectstack/spec';
|
|
9
|
+
type ProtocolFieldType = Data.FieldType;
|
|
10
|
+
type Field = Data.Field;
|
|
11
|
+
type SpecSelectOption = Data.SelectOption;
|
|
9
12
|
/**
|
|
10
13
|
* Re-export Protocol Types from the Constitution
|
|
11
14
|
* These are the wire-protocol standard types defined in @objectstack/spec
|
|
@@ -101,7 +104,7 @@ export interface FieldOption {
|
|
|
101
104
|
* - `deleteBehavior`: Made optional with protocol-compatible enum values
|
|
102
105
|
*
|
|
103
106
|
* All other protocol properties (description, defaultValue, maxLength, minLength, precision, scale, min, max,
|
|
104
|
-
* reference, referenceFilters, writeRequiresMasterRead, expression,
|
|
107
|
+
* reference, referenceFilters, writeRequiresMasterRead, expression, summaryOperations) are inherited as-is.
|
|
105
108
|
*/
|
|
106
109
|
export interface FieldConfig extends Omit<Field, 'name' | 'label' | 'type' | 'options' | 'required' | 'multiple' | 'unique' | 'deleteBehavior' | 'hidden' | 'readonly' | 'encryption' | 'index' | 'externalId' | 'searchable'> {
|
|
107
110
|
/** Field name (inferred from Record key when used in ObjectConfig.fields) */
|
package/dist/object.d.ts
CHANGED
|
@@ -5,16 +5,9 @@
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
import type { ServiceObject, IndexSchema } from '@objectstack/spec';
|
|
9
8
|
import { FieldConfig } from './field';
|
|
10
9
|
import { ActionConfig } from './action';
|
|
11
10
|
import { AnyValidationRule } from './validation';
|
|
12
|
-
/**
|
|
13
|
-
* Re-export Protocol Types from the Constitution
|
|
14
|
-
*
|
|
15
|
-
* @deprecated Import directly from @objectstack/spec instead
|
|
16
|
-
*/
|
|
17
|
-
export type { ServiceObject as SpecObject, IndexSchema };
|
|
18
11
|
/**
|
|
19
12
|
* RUNTIME-SPECIFIC TYPES
|
|
20
13
|
* The following types extend or complement the Protocol Constitution
|
|
@@ -61,7 +54,7 @@ export interface ObjectAiConfig {
|
|
|
61
54
|
* Runtime Object Configuration
|
|
62
55
|
*
|
|
63
56
|
* Extends the Protocol ServiceObject with runtime-specific properties.
|
|
64
|
-
* The Protocol Constitution
|
|
57
|
+
* The Protocol Constitution defines the core object schema.
|
|
65
58
|
* This adds runtime conveniences like actions, AI config, and validation rules.
|
|
66
59
|
*/
|
|
67
60
|
export interface ObjectConfig {
|
package/dist/query.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import { Data } from '@objectstack/spec';
|
|
9
|
+
type FilterCondition = Data.FilterCondition;
|
|
9
10
|
/**
|
|
10
11
|
* Modern Query Filter using @objectstack/spec FilterCondition
|
|
11
12
|
*
|
|
@@ -21,32 +22,70 @@ import type { FilterCondition } from '@objectstack/spec';
|
|
|
21
22
|
* Note: $not operator is not supported. Use $ne for field-level negation.
|
|
22
23
|
*/
|
|
23
24
|
export type Filter = FilterCondition;
|
|
24
|
-
|
|
25
|
+
/** @deprecated Use AggregationFunctionType instead */
|
|
26
|
+
export type AggregateFunction = AggregationFunctionType;
|
|
27
|
+
/** @deprecated Use AggregationNode instead */
|
|
25
28
|
export interface AggregateOption {
|
|
26
29
|
func: AggregateFunction;
|
|
27
30
|
field: string;
|
|
28
31
|
alias?: string;
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
31
|
-
*
|
|
34
|
+
* Sort Node - Standard Protocol Format
|
|
35
|
+
* Represents an "Order By" clause.
|
|
36
|
+
*/
|
|
37
|
+
export interface SortNode {
|
|
38
|
+
/** Field name to sort by */
|
|
39
|
+
field: string;
|
|
40
|
+
/** Sort direction - defaults to 'asc' */
|
|
41
|
+
order: 'asc' | 'desc';
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Aggregation Function - Standard Protocol Format
|
|
45
|
+
*/
|
|
46
|
+
export type AggregationFunctionType = 'count' | 'sum' | 'avg' | 'min' | 'max' | 'count_distinct' | 'array_agg' | 'string_agg';
|
|
47
|
+
/**
|
|
48
|
+
* Aggregation Node - Standard Protocol Format
|
|
49
|
+
* Represents an aggregated field with function.
|
|
50
|
+
*/
|
|
51
|
+
export interface AggregationNode {
|
|
52
|
+
/** Aggregation function to apply */
|
|
53
|
+
function: AggregationFunctionType;
|
|
54
|
+
/** Field to aggregate (optional for count) */
|
|
55
|
+
field?: string;
|
|
56
|
+
/** Alias for the result field */
|
|
57
|
+
alias: string;
|
|
58
|
+
/** Apply DISTINCT to the field before aggregation */
|
|
59
|
+
distinct?: boolean;
|
|
60
|
+
/** Optional filter condition for this aggregation */
|
|
61
|
+
filter?: Filter;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Unified Query Interface - Standard Protocol Format
|
|
32
65
|
*
|
|
33
|
-
*
|
|
66
|
+
* Uses @objectstack/spec QueryAST format directly.
|
|
67
|
+
* This is the single source of truth for query structure.
|
|
34
68
|
*/
|
|
35
69
|
export interface UnifiedQuery {
|
|
36
70
|
/** Field selection - specify which fields to return */
|
|
37
71
|
fields?: string[];
|
|
38
|
-
/** Filter conditions using
|
|
39
|
-
|
|
40
|
-
/** Sort order - array of
|
|
41
|
-
|
|
42
|
-
/** Pagination - number of records to skip */
|
|
43
|
-
|
|
72
|
+
/** Filter conditions using standard FilterCondition syntax (was: filters) */
|
|
73
|
+
where?: Filter;
|
|
74
|
+
/** Sort order - array of SortNode objects (was: sort as tuples) */
|
|
75
|
+
orderBy?: SortNode[];
|
|
76
|
+
/** Pagination - number of records to skip (was: skip) */
|
|
77
|
+
offset?: number;
|
|
44
78
|
/** Pagination - maximum number of records to return */
|
|
45
79
|
limit?: number;
|
|
46
80
|
/** Relation expansion - load related records */
|
|
47
81
|
expand?: Record<string, UnifiedQuery>;
|
|
48
82
|
/** Aggregation - group by fields */
|
|
49
83
|
groupBy?: string[];
|
|
50
|
-
/** Aggregation - aggregate functions to apply */
|
|
51
|
-
|
|
84
|
+
/** Aggregation - aggregate functions to apply (was: aggregate with func) */
|
|
85
|
+
aggregations?: AggregationNode[];
|
|
86
|
+
/** Filter for aggregated results (HAVING clause) */
|
|
87
|
+
having?: Filter;
|
|
88
|
+
/** Enable distinct results */
|
|
89
|
+
distinct?: boolean;
|
|
52
90
|
}
|
|
91
|
+
export {};
|
package/dist/registry.d.ts
CHANGED
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
|
-
* Re-export MetadataRegistry and MetadataItem from @
|
|
9
|
+
* Re-export MetadataRegistry and MetadataItem from @objectql/runtime
|
|
10
10
|
*
|
|
11
11
|
* As of Week 3 refactoring, metadata management has been moved to the
|
|
12
|
-
* @
|
|
12
|
+
* @objectql/runtime package to enable sharing across the ecosystem.
|
|
13
13
|
*/
|
|
14
|
-
export { MetadataRegistry, MetadataItem } from '
|
|
14
|
+
export { MetadataRegistry, MetadataItem } from '../../../objectstack/runtime/dist';
|
|
15
15
|
/**
|
|
16
16
|
* Legacy Metadata interface - kept for backward compatibility
|
|
17
|
-
* @deprecated Use MetadataItem from @
|
|
17
|
+
* @deprecated Use MetadataItem from @objectql/runtime instead
|
|
18
18
|
*/
|
|
19
19
|
export interface Metadata {
|
|
20
20
|
type: string;
|
package/dist/registry.js
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.MetadataRegistry = void 0;
|
|
11
11
|
/**
|
|
12
|
-
* Re-export MetadataRegistry and MetadataItem from @
|
|
12
|
+
* Re-export MetadataRegistry and MetadataItem from @objectql/runtime
|
|
13
13
|
*
|
|
14
14
|
* As of Week 3 refactoring, metadata management has been moved to the
|
|
15
|
-
* @
|
|
15
|
+
* @objectql/runtime package to enable sharing across the ecosystem.
|
|
16
16
|
*/
|
|
17
|
-
var
|
|
18
|
-
Object.defineProperty(exports, "MetadataRegistry", { enumerable: true, get: function () { return
|
|
17
|
+
var dist_1 = require("../../../objectstack/runtime/dist");
|
|
18
|
+
Object.defineProperty(exports, "MetadataRegistry", { enumerable: true, get: function () { return dist_1.MetadataRegistry; } });
|
|
19
19
|
//# sourceMappingURL=registry.js.map
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;;;GAKG;AACH,0DAAmF;AAA1E,wGAAA,gBAAgB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectql/types",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Pure TypeScript type definitions and interfaces for the ObjectQL protocol - The Contract",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"objectql",
|
|
@@ -27,12 +27,13 @@
|
|
|
27
27
|
"test": "jest --passWithNoTests"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@objectstack/spec": "^0.
|
|
31
|
-
"@
|
|
30
|
+
"@objectstack/spec": "^0.3.3",
|
|
31
|
+
"@objectql/runtime": "^0.2.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@objectstack/spec": "
|
|
35
|
-
"@
|
|
36
|
-
"ts-json-schema-generator": "^2.4.0"
|
|
34
|
+
"@objectstack/spec": "^0.3.3",
|
|
35
|
+
"@objectql/runtime": "workspace:*",
|
|
36
|
+
"ts-json-schema-generator": "^2.4.0",
|
|
37
|
+
"zod": "^3.23.8"
|
|
37
38
|
}
|
|
38
39
|
}
|