@mkja/o-data 0.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.
@@ -0,0 +1,43 @@
1
+ import type { QueryableEntity, EntitySetToQueryableEntity } from './types';
2
+ import type { Schema } from './schema';
3
+ import type { FilterHelpers, FilterBuilder } from './filter';
4
+ export type QueryOperationOptions = {
5
+ prefer?: {
6
+ maxpagesize?: number;
7
+ return_representation?: boolean;
8
+ };
9
+ headers?: Record<string, string>;
10
+ };
11
+ type ResolveNavigationTarget<S extends Schema<S>, TargetKey extends string | string[]> = TargetKey extends string ? TargetKey extends keyof S['entitysets'] ? EntitySetToQueryableEntity<S, TargetKey> : QueryableEntity : QueryableEntity;
12
+ export type SingleExpandObject<E extends QueryableEntity, S extends Schema<S> = Schema<any>> = {
13
+ select?: readonly (keyof E['properties'])[];
14
+ expand?: {
15
+ [K in keyof E['navigations']]?: E['navigations'][K]['targetEntitysetKey'] extends string | string[] ? E['navigations'][K]['collection'] extends true ? CollectionQueryObject<ResolveNavigationTarget<S, E['navigations'][K]['targetEntitysetKey']>, S> : SingleExpandObject<ResolveNavigationTarget<S, E['navigations'][K]['targetEntitysetKey']>, S> : never;
16
+ };
17
+ };
18
+ type BaseQueryObject<E extends QueryableEntity, S extends Schema<S> = Schema<any>> = {
19
+ select?: readonly (keyof E['properties'])[];
20
+ expand?: {
21
+ [K in keyof E['navigations']]?: E['navigations'][K]['targetEntitysetKey'] extends string | string[] ? E['navigations'][K]['collection'] extends true ? CollectionQueryObject<ResolveNavigationTarget<S, E['navigations'][K]['targetEntitysetKey']>, S> : SingleExpandObject<ResolveNavigationTarget<S, E['navigations'][K]['targetEntitysetKey']>, S> : never;
22
+ };
23
+ filter?: (h: FilterHelpers<E, S>) => FilterBuilder<E>;
24
+ orderby?: readonly [keyof E['properties'], 'asc' | 'desc'];
25
+ };
26
+ export type CollectionQueryObject<E extends QueryableEntity, S extends Schema<S> = Schema<any>> = BaseQueryObject<E, S> & {
27
+ top?: number;
28
+ skip?: number;
29
+ count?: boolean;
30
+ };
31
+ export type SingleQueryObject<E extends QueryableEntity, S extends Schema<S> = Schema<any>> = {
32
+ select?: readonly (keyof E['properties'])[];
33
+ expand?: {
34
+ [K in keyof E['navigations']]?: E['navigations'][K]['targetEntitysetKey'] extends string | string[] ? E['navigations'][K]['collection'] extends true ? CollectionQueryObject<ResolveNavigationTarget<S, E['navigations'][K]['targetEntitysetKey']>, S> : SingleExpandObject<ResolveNavigationTarget<S, E['navigations'][K]['targetEntitysetKey']>, S> : never;
35
+ };
36
+ };
37
+ export type CollectionQueryResultData<E extends QueryableEntity, Q extends CollectionQueryObject<E>> = {
38
+ data: any[];
39
+ };
40
+ export type SingleQueryResultData<E extends QueryableEntity, Q extends SingleQueryObject<E>> = {
41
+ data: any;
42
+ };
43
+ export {};
package/dist/query.js ADDED
@@ -0,0 +1,3 @@
1
+ // ============================================================================
2
+ // Query Object Types
3
+ // ============================================================================
@@ -0,0 +1,132 @@
1
+ export type ODataMetadata = {
2
+ '@odata.context'?: string;
3
+ '@odata.count'?: number;
4
+ '@odata.nextLink'?: string;
5
+ [key: string]: any;
6
+ };
7
+ export type ODataResponse<TSuccess, TError = {
8
+ error: any;
9
+ }> = {
10
+ ok: true;
11
+ status: number;
12
+ statusText: string;
13
+ headers?: Headers;
14
+ result: TSuccess;
15
+ } | {
16
+ ok: false;
17
+ status: number;
18
+ statusText: string;
19
+ headers?: Headers;
20
+ result: TError;
21
+ };
22
+ export type ODataError = {
23
+ error: any;
24
+ };
25
+ import type { QueryableEntity, ODataTypeToTS } from './types';
26
+ import type { Schema, ODataType } from './schema';
27
+ import type { CollectionQueryObject, SingleQueryObject, SingleExpandObject } from './query';
28
+ type ExtractSelectKeys<E extends QueryableEntity, Q extends {
29
+ select?: readonly (keyof E['properties'])[];
30
+ }> = Q['select'] extends readonly (keyof E['properties'])[] ? Q['select'][number] : keyof E['properties'];
31
+ type ExtractExpandShape<E extends QueryableEntity, Q extends {
32
+ expand?: Record<string, any>;
33
+ }, S extends Schema<S> = Schema<any>> = Q['expand'] extends Record<string, any> ? {
34
+ [K in keyof Q['expand'] & keyof E['navigations']]: Q['expand'][K] extends SingleExpandObject<E['navigations'][K]['target']> | SingleQueryObject<E['navigations'][K]['target']> | CollectionQueryObject<E['navigations'][K]['target']> ? E['navigations'][K]['collection'] extends true ? Array<ExtractQueryResultShape<E['navigations'][K]['target'], Q['expand'][K], S>> : ExtractQueryResultShape<E['navigations'][K]['target'], Q['expand'][K], S> : never;
35
+ } : {};
36
+ type ExtractQueryResultShape<E extends QueryableEntity, Q extends {
37
+ select?: readonly (keyof E['properties'])[];
38
+ expand?: Record<string, any>;
39
+ }, S extends Schema<S> = Schema<any>> = Pick<E['properties'], ExtractSelectKeys<E, Q>> & ExtractExpandShape<E, Q, S>;
40
+ export type CollectionQueryData<E extends QueryableEntity = any, Q extends CollectionQueryObject<E, any> = any, O = any> = Q extends CollectionQueryObject<E, infer S> ? {
41
+ data: ExtractQueryResultShape<E, Q, S>[];
42
+ } & ODataMetadata : {
43
+ data: any[];
44
+ } & ODataMetadata;
45
+ export type CollectionQueryError = ODataError;
46
+ export type CollectionQueryResponse<E extends QueryableEntity = any, Q extends CollectionQueryObject<E, any> = any, O = any> = ODataResponse<CollectionQueryData<E, Q, O>, CollectionQueryError> & {
47
+ next?: () => Promise<CollectionQueryResponse<E, Q, O>>;
48
+ };
49
+ export type SingleQueryData<E extends QueryableEntity = any, Q extends SingleQueryObject<E, any> = any> = Q extends SingleQueryObject<E, infer S> ? {
50
+ data: ExtractQueryResultShape<E, Q, S>;
51
+ } & ODataMetadata : {
52
+ data: any;
53
+ } & ODataMetadata;
54
+ export type SingleQueryError = ODataError;
55
+ export type SingleQueryResponse<E extends QueryableEntity = any, Q extends SingleQueryObject<E> = any, O = any> = ODataResponse<SingleQueryData<E, Q>, SingleQueryError>;
56
+ type ExtractSelectKeysForOperation<QE extends {
57
+ properties: Record<string, any>;
58
+ }, Select extends readonly (keyof QE['properties'])[]> = Select[number];
59
+ type CreateDataShape<QE extends QueryableEntity, O extends {
60
+ select?: readonly (keyof QE['properties'])[];
61
+ prefer?: {
62
+ return_representation?: boolean;
63
+ };
64
+ }> = O['prefer'] extends {
65
+ return_representation: true;
66
+ } ? QE['properties'] : O['select'] extends readonly (keyof QE['properties'])[] ? Pick<QE['properties'], ExtractSelectKeysForOperation<QE, O['select']>> : undefined;
67
+ export type CreateResultData<QE extends QueryableEntity = any, O extends {
68
+ select?: readonly (keyof QE['properties'])[];
69
+ prefer?: {
70
+ return_representation?: boolean;
71
+ };
72
+ } = any> = O['prefer'] extends {
73
+ return_representation: true;
74
+ } ? ({
75
+ data: CreateDataShape<QE, O>;
76
+ } & ODataMetadata) : O['select'] extends readonly (keyof QE['properties'])[] ? ({
77
+ data: CreateDataShape<QE, O>;
78
+ } & ODataMetadata) : {
79
+ data: undefined;
80
+ };
81
+ export type CreateResultError = ODataError;
82
+ export type CreateResponse<QE extends QueryableEntity = any, O extends {
83
+ select?: readonly (keyof QE['properties'])[];
84
+ prefer?: {
85
+ return_representation?: boolean;
86
+ };
87
+ } = any> = ODataResponse<CreateResultData<QE, O>, CreateResultError>;
88
+ type UpdateDataShape<QE extends QueryableEntity, O extends {
89
+ select?: readonly (keyof QE['properties'])[];
90
+ prefer?: {
91
+ return_representation?: boolean;
92
+ };
93
+ }> = O['prefer'] extends {
94
+ return_representation: true;
95
+ } ? QE['properties'] : O['select'] extends readonly (keyof QE['properties'])[] ? Pick<QE['properties'], ExtractSelectKeysForOperation<QE, O['select']>> : undefined;
96
+ export type UpdateResultData<QE extends QueryableEntity = any, O extends {
97
+ select?: readonly (keyof QE['properties'])[];
98
+ prefer?: {
99
+ return_representation?: boolean;
100
+ };
101
+ } = any> = O['prefer'] extends {
102
+ return_representation: true;
103
+ } ? ({
104
+ data: UpdateDataShape<QE, O>;
105
+ } & ODataMetadata) : O['select'] extends readonly (keyof QE['properties'])[] ? ({
106
+ data: UpdateDataShape<QE, O>;
107
+ } & ODataMetadata) : {
108
+ data: undefined;
109
+ };
110
+ export type UpdateResultError = ODataError;
111
+ export type UpdateResponse<QE extends QueryableEntity = any, O extends {
112
+ select?: readonly (keyof QE['properties'])[];
113
+ prefer?: {
114
+ return_representation?: boolean;
115
+ };
116
+ } = any> = ODataResponse<UpdateResultData<QE, O>, UpdateResultError>;
117
+ export type DeleteResultData = {
118
+ data: undefined;
119
+ } & ODataMetadata;
120
+ export type DeleteResultError = ODataError;
121
+ export type DeleteResponse = ODataResponse<DeleteResultData, DeleteResultError>;
122
+ export type ActionResultData<R = any> = {
123
+ data: R extends undefined ? void : R;
124
+ } & ODataMetadata;
125
+ export type ActionResultError = ODataError;
126
+ export type ActionResponse<S extends Schema<S> = any, R extends ODataType<any> | undefined = undefined> = R extends undefined ? ODataResponse<ActionResultData<void>, ActionResultError> : ODataResponse<ActionResultData<ODataTypeToTS<Exclude<R, undefined>, S>>, ActionResultError>;
127
+ export type FunctionResultData<R = any> = {
128
+ data: R;
129
+ } & ODataMetadata;
130
+ export type FunctionResultError = ODataError;
131
+ export type FunctionResponse<S extends Schema<S> = any, R extends ODataType<any> = any> = ODataResponse<FunctionResultData<ODataTypeToTS<R, S>>, FunctionResultError>;
132
+ export {};
@@ -0,0 +1,3 @@
1
+ // ============================================================================
2
+ // Response Types
3
+ // ============================================================================
@@ -0,0 +1,4 @@
1
+ import type { Schema } from './schema';
2
+ import type { QueryableEntity } from './types';
3
+ export declare function findEntitySetsForEntityType<S extends Schema<S>>(schema: S, entitytypeName: string): string | string[];
4
+ export declare function buildQueryableEntity<S extends Schema<S>>(schema: S, entitysetName: string | string[]): QueryableEntity;
@@ -0,0 +1,113 @@
1
+ // ============================================================================
2
+ // Runtime QueryableEntity Builder
3
+ // ============================================================================
4
+ // ============================================================================
5
+ // Helper: Check if a property is a navigation
6
+ // ============================================================================
7
+ function isNavigation(prop) {
8
+ return prop && typeof prop === 'object' && prop.type === 'navigation';
9
+ }
10
+ // ============================================================================
11
+ // Helper: Flatten EntityType with baseType inheritance
12
+ // ============================================================================
13
+ function flattenEntityType(schema, entitytypeName, visited = new Set()) {
14
+ // Circular reference protection
15
+ if (visited.has(entitytypeName)) {
16
+ return { properties: {} };
17
+ }
18
+ const entitytypes = schema.entitytypes;
19
+ const entitytype = entitytypes[entitytypeName];
20
+ if (!entitytype) {
21
+ return { properties: {} };
22
+ }
23
+ visited.add(entitytypeName);
24
+ // If no baseType, return as-is
25
+ if (!entitytype.baseType) {
26
+ visited.delete(entitytypeName);
27
+ return entitytype;
28
+ }
29
+ // Recursively flatten baseType
30
+ const baseTypeName = entitytype.baseType;
31
+ const baseType = flattenEntityType(schema, baseTypeName, visited);
32
+ // Merge properties objects (current overrides base)
33
+ const flattened = {
34
+ baseType: entitytype.baseType,
35
+ properties: {
36
+ ...(baseType.properties || {}),
37
+ ...(entitytype.properties || {}),
38
+ },
39
+ };
40
+ visited.delete(entitytypeName);
41
+ return flattened;
42
+ }
43
+ // ============================================================================
44
+ // Helper: Find entityset(s) for an entitytype
45
+ // ============================================================================
46
+ export function findEntitySetsForEntityType(schema, entitytypeName) {
47
+ const entitysets = [];
48
+ const entitysetsRecord = schema.entitysets;
49
+ for (const [entitysetName, entityset] of Object.entries(entitysetsRecord)) {
50
+ if (entityset.entitytype === entitytypeName) {
51
+ entitysets.push(entitysetName);
52
+ }
53
+ }
54
+ if (entitysets.length === 0) {
55
+ return '';
56
+ }
57
+ else if (entitysets.length === 1) {
58
+ return entitysets[0];
59
+ }
60
+ else {
61
+ return entitysets;
62
+ }
63
+ }
64
+ // ============================================================================
65
+ // Build QueryableEntity from EntitySet
66
+ // ============================================================================
67
+ export function buildQueryableEntity(schema, entitysetName) {
68
+ // Handle array case - use first entityset
69
+ const actualEntitysetName = Array.isArray(entitysetName)
70
+ ? (entitysetName[0] || '')
71
+ : entitysetName;
72
+ if (!actualEntitysetName) {
73
+ return {
74
+ properties: {},
75
+ navigations: {},
76
+ };
77
+ }
78
+ const entitysets = schema.entitysets;
79
+ const entityset = entitysets[actualEntitysetName];
80
+ if (!entityset) {
81
+ return {
82
+ properties: {},
83
+ navigations: {},
84
+ };
85
+ }
86
+ const entitytypeName = entityset.entitytype;
87
+ const flattenedEntityType = flattenEntityType(schema, entitytypeName);
88
+ // Extract properties (non-navigation fields)
89
+ const properties = {};
90
+ for (const [key, value] of Object.entries(flattenedEntityType.properties || {})) {
91
+ if (!isNavigation(value)) {
92
+ properties[key] = value;
93
+ }
94
+ }
95
+ // Extract navigations
96
+ const navigations = {};
97
+ for (const [key, value] of Object.entries(flattenedEntityType.properties || {})) {
98
+ if (isNavigation(value)) {
99
+ const targetEntitytypeName = value.target;
100
+ const targetEntitysetKey = findEntitySetsForEntityType(schema, targetEntitytypeName);
101
+ const collection = value.collection === true;
102
+ navigations[key] = {
103
+ target: targetEntitytypeName,
104
+ targetEntitysetKey: targetEntitysetKey || '',
105
+ collection,
106
+ };
107
+ }
108
+ }
109
+ return {
110
+ properties,
111
+ navigations,
112
+ };
113
+ }
@@ -0,0 +1,128 @@
1
+ export type PrimitiveName = 'Edm.Binary' | 'Edm.Boolean' | 'Edm.Byte' | 'Edm.Date' | 'Edm.DateTimeOffset' | 'Edm.Decimal' | 'Edm.Double' | 'Edm.Duration' | 'Edm.Guid' | 'Edm.Int16' | 'Edm.Int32' | 'Edm.Int64' | 'Edm.SByte' | 'Edm.Single' | 'Edm.Stream' | 'Edm.String' | 'Edm.TimeOfDay' | 'Edm.Untyped' | 'Edm.Geography' | 'Edm.GeographyPoint' | 'Edm.GeographyLineString' | 'Edm.GeographyPolygon' | 'Edm.GeographyMultiPoint' | 'Edm.GeographyMultiLineString' | 'Edm.GeographyMultiPolygon' | 'Edm.GeographyCollection' | 'Edm.Geometry' | 'Edm.GeometryPoint' | 'Edm.GeometryLineString' | 'Edm.GeometryPolygon' | 'Edm.GeometryMultiPoint' | 'Edm.GeometryMultiLineString' | 'Edm.GeometryMultiPolygon' | 'Edm.GeometryCollection' | 'Edm.ModelElementPath' | 'Edm.AnyPropertyPath';
2
+ export type TypeOptions = {
3
+ nullable?: boolean;
4
+ collection?: boolean;
5
+ };
6
+ export type PrimitiveType = {
7
+ type: PrimitiveName;
8
+ } & TypeOptions;
9
+ export type EnumTypeDefinition = {
10
+ isFlags?: boolean;
11
+ members: {
12
+ [name: string]: number;
13
+ };
14
+ };
15
+ export type EnumType<TEnumKeys extends string = string> = {
16
+ type: 'enum';
17
+ target: TEnumKeys;
18
+ } & TypeOptions;
19
+ export type ComplexType<TComplexKeys extends string = string> = {
20
+ type: 'complex';
21
+ target: TComplexKeys;
22
+ } & TypeOptions;
23
+ export type NavigationType<TTarget extends string = string> = {
24
+ type: 'navigation';
25
+ target: TTarget;
26
+ } & TypeOptions;
27
+ export type ODataType<TEntityTypeKeys extends string = string, TEnumKeys extends string = string, TComplexKeys extends string = string> = PrimitiveType | EnumType<TEnumKeys> | ComplexType<TComplexKeys> | NavigationType<TEntityTypeKeys>;
28
+ export type ComplexTypeDefinition<TEntityTypeKeys extends string = string, TEnumKeys extends string = string, TComplexKeys extends string = string> = {
29
+ [key: string]: ODataType<TEntityTypeKeys, TEnumKeys, TComplexKeys>;
30
+ };
31
+ export type EntityType<TEntityTypeKeys extends string = string, TEnumKeys extends string = string, TComplexKeys extends string = string> = {
32
+ baseType?: Extract<TEntityTypeKeys, string>;
33
+ properties: {
34
+ [key: string]: ODataType<TEntityTypeKeys, TEnumKeys, TComplexKeys>;
35
+ };
36
+ };
37
+ export type BoundAction<TEntityTypeKeys extends string = string> = {
38
+ type: 'bound';
39
+ collection: boolean;
40
+ target: TEntityTypeKeys;
41
+ parameters: Record<string, ODataType<TEntityTypeKeys, any, any>>;
42
+ returnType?: ODataType<TEntityTypeKeys, any, any>;
43
+ };
44
+ export type UnboundAction<TEntityTypeKeys extends string = string> = {
45
+ type: 'unbound';
46
+ parameters: Record<string, ODataType<TEntityTypeKeys, any, any>>;
47
+ returnType?: ODataType<TEntityTypeKeys, any, any>;
48
+ };
49
+ export type Action<TEntityTypeKeys extends string = string> = BoundAction<TEntityTypeKeys> | UnboundAction<TEntityTypeKeys>;
50
+ export type BoundFunction<TEntityTypeKeys extends string = string> = {
51
+ type: 'bound';
52
+ collection: boolean;
53
+ target: TEntityTypeKeys;
54
+ parameters: Record<string, ODataType<TEntityTypeKeys, any, any>>;
55
+ returnType: ODataType<TEntityTypeKeys, any, any>;
56
+ };
57
+ export type UnboundFunction<TEntityTypeKeys extends string = string> = {
58
+ type: 'unbound';
59
+ parameters: Record<string, ODataType<TEntityTypeKeys, any, any>>;
60
+ returnType: ODataType<TEntityTypeKeys, any, any>;
61
+ };
62
+ export type Function<TEntityTypeKeys extends string = string> = BoundFunction<TEntityTypeKeys> | UnboundFunction<TEntityTypeKeys>;
63
+ export type ActionImport<TActionKeys extends string> = {
64
+ action: TActionKeys;
65
+ };
66
+ export type FunctionImport<TFunctionKeys extends string> = {
67
+ function: TFunctionKeys;
68
+ };
69
+ type UnboundActionKeysFromRaw<T extends {
70
+ actions?: Record<string, any>;
71
+ }> = 'actions' extends keyof T ? T['actions'] extends Record<string, any> ? {
72
+ [K in keyof T['actions']]: T['actions'][K] extends {
73
+ type: 'unbound';
74
+ } ? K : never;
75
+ }[keyof T['actions']] : never : never;
76
+ type UnboundFunctionKeysFromRaw<T extends {
77
+ functions?: Record<string, any>;
78
+ }> = 'functions' extends keyof T ? T['functions'] extends Record<string, any> ? {
79
+ [K in keyof T['functions']]: T['functions'][K] extends {
80
+ type: 'unbound';
81
+ } ? K : never;
82
+ }[keyof T['functions']] : never : never;
83
+ export interface Schema<T extends {
84
+ namespace: string;
85
+ alias: string;
86
+ entitytypes: Record<string, any>;
87
+ entitysets: Record<string, any>;
88
+ enumtypes?: Record<string, any>;
89
+ complextypes?: Record<string, any>;
90
+ actions?: Record<string, any>;
91
+ functions?: Record<string, any>;
92
+ }> {
93
+ namespace: string;
94
+ alias: string;
95
+ entitytypes: {
96
+ [key: string]: EntityType<Extract<keyof T['entitytypes'], string>, Extract<keyof NonNullable<T['enumtypes']>, string>, Extract<keyof NonNullable<T['complextypes']>, string>>;
97
+ };
98
+ entitysets: {
99
+ [key: string]: {
100
+ entitytype: Extract<keyof T['entitytypes'], string>;
101
+ };
102
+ };
103
+ enumtypes?: {
104
+ [key: string]: EnumTypeDefinition;
105
+ };
106
+ complextypes?: {
107
+ [key: string]: ComplexTypeDefinition<Extract<keyof T['entitytypes'], string>, Extract<keyof NonNullable<T['enumtypes']>, string>, Extract<keyof NonNullable<T['complextypes']>, string>>;
108
+ };
109
+ actions?: {
110
+ [key: string]: Action<Extract<keyof T['entitytypes'], string>>;
111
+ };
112
+ functions?: {
113
+ [key: string]: Function<Extract<keyof T['entitytypes'], string>>;
114
+ };
115
+ actionImports?: T['actions'] extends Record<string, any> ? {
116
+ [key: string]: ActionImport<Extract<UnboundActionKeysFromRaw<T>, string>>;
117
+ } : never;
118
+ functionImports?: T['functions'] extends Record<string, any> ? {
119
+ [key: string]: FunctionImport<Extract<UnboundFunctionKeysFromRaw<T>, string>>;
120
+ } : never;
121
+ }
122
+ export type EntityTypeFromEntitySet<T extends Schema<T>, K extends keyof T['entitysets']> = T['entitysets'][K]['entitytype'];
123
+ export type EntityTypeFromEntityTypeKeys<T extends Schema<T>, K extends keyof T['entitytypes']> = T['entitytypes'][K];
124
+ export type NavigationsTarget<N extends {
125
+ target: any;
126
+ }> = N['target'];
127
+ export declare function schema<S extends Schema<S>>(definition: S): S;
128
+ export {};
package/dist/schema.js ADDED
@@ -0,0 +1,11 @@
1
+ // ============================================================================
2
+ // Schema Definition Types
3
+ // ============================================================================
4
+ // ============================================================================
5
+ // Schema Builder Function
6
+ // ============================================================================
7
+ export function schema(definition) {
8
+ // Identity function - schema stays raw, no runtime transformation
9
+ // Optional: Add runtime validation here (circular inheritance, etc.)
10
+ return definition;
11
+ }
@@ -0,0 +1,42 @@
1
+ import type { QueryableEntity } from './types';
2
+ import type { CollectionQueryObject, SingleQueryObject } from './query';
3
+ import type { Schema, ODataType } from './schema';
4
+ import type { CreateObject, UpdateObject, CreateOperationOptions, UpdateOperationOptions } from './operations';
5
+ /**
6
+ * Normalizes URL path segments by:
7
+ * - Removing trailing slashes from baseUrl (preserving protocol ://)
8
+ * - Removing leading slashes from path segments
9
+ * - Joining with single /
10
+ * - Normalizing multiple consecutive slashes (except protocol)
11
+ */
12
+ export declare function normalizePath(baseUrl: string, ...paths: string[]): string;
13
+ export declare function buildQueryString<S extends Schema<S>>(query: SingleQueryObject<any> | CollectionQueryObject<any>, entityDef: QueryableEntity, schema: S): string;
14
+ /**
15
+ * Transform create object to handle navigation properties with @odata.bind format
16
+ */
17
+ export declare function transformCreateObjectForBind<S extends Schema<S>>(createObject: CreateObject<any>, entityDef: QueryableEntity | undefined, schema: S): any;
18
+ /**
19
+ * Transform update object to handle navigation properties with @odata.bind format
20
+ */
21
+ export declare function transformUpdateObjectForBind<S extends Schema<S>>(updateObject: UpdateObject<any>, entityDef: QueryableEntity | undefined, schema: S): any;
22
+ /**
23
+ * Build HTTP Request for create operation
24
+ */
25
+ export declare function buildCreateRequest<S extends Schema<S>>(path: string, createObject: CreateObject<any>, options: CreateOperationOptions<any> | undefined, baseUrl: string, entityDef: QueryableEntity, schema: S): Request;
26
+ /**
27
+ * Build HTTP Request for update operation
28
+ */
29
+ export declare function buildUpdateRequest<S extends Schema<S>>(path: string, updateObject: UpdateObject<any>, options: UpdateOperationOptions<any> | undefined, baseUrl: string, entityDef: QueryableEntity, schema: S): Request;
30
+ /**
31
+ * Transform action/function parameters to handle navigation (entity type) parameters.
32
+ * Converts string/number IDs to @odata.bind format and handles deep inserts.
33
+ */
34
+ export declare function transformActionParameters<S extends Schema<S>>(parameters: Record<string, any>, parameterDefs: Record<string, ODataType<any>>, schema: S): any;
35
+ /**
36
+ * Build a POST request for an OData action.
37
+ */
38
+ export declare function buildActionRequest<S extends Schema<S>>(path: string, namespace: string, actionName: string, parameters: Record<string, any>, parameterDefs: Record<string, ODataType<any>>, schema: S, baseUrl?: string, useFQN?: boolean): Request;
39
+ /**
40
+ * Build a GET request for an OData function.
41
+ */
42
+ export declare function buildFunctionRequest<S extends Schema<S>>(path: string, namespace: string, functionName: string, parameters: Record<string, any>, baseUrl?: string, useFQN?: boolean): Request;