resora 0.2.1 → 0.2.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/bin/index.mjs +5 -5
- package/dist/index.cjs +362 -5
- package/dist/index.d.cts +375 -4
- package/dist/index.d.mts +375 -4
- package/dist/index.mjs +358 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -124,27 +124,75 @@ type GenericBody<R extends NonCollectible | Collectible | ResourceData = Resourc
|
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region src/types/config.d.ts
|
|
126
126
|
interface Config {
|
|
127
|
+
/**
|
|
128
|
+
* @description The directory where resource definitions are located.
|
|
129
|
+
* @default 'resources'
|
|
130
|
+
*/
|
|
127
131
|
resourcesDir: string;
|
|
132
|
+
/**
|
|
133
|
+
* @description The directory where stub files are located.
|
|
134
|
+
* @default 'node_modules/resora/stubs'
|
|
135
|
+
*/
|
|
128
136
|
stubsDir: string;
|
|
137
|
+
/**
|
|
138
|
+
* @description The file names of the various stub templates used for generating resources and configuration.
|
|
139
|
+
* Each property corresponds to a specific type of stub:
|
|
140
|
+
* - config: The stub file for generating the default configuration file.
|
|
141
|
+
* - resource: The stub file for generating a single resource.
|
|
142
|
+
* - collection: The stub file for generating a collection of resources.
|
|
143
|
+
* All properties are required and should be provided as strings representing the file names of the respective stubs.
|
|
144
|
+
*/
|
|
129
145
|
stubs: {
|
|
130
146
|
config: string;
|
|
131
147
|
resource: string;
|
|
132
148
|
collection: string;
|
|
133
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* @description The preferred case style for resource keys in the response.
|
|
152
|
+
* Can be set to a preset string ('camel', 'snake', 'pascal', 'kebab') or a custom transformer function.
|
|
153
|
+
* @default 'camel'
|
|
154
|
+
*/
|
|
134
155
|
preferredCase: CaseStyle;
|
|
156
|
+
/**
|
|
157
|
+
* @description An array or object specifying which additional data to include in paginated responses.
|
|
158
|
+
* Can include 'meta', 'links', and/or 'cursor'. If an object is provided, the keys can be customized to specify the property names for each type of extra data in the response.
|
|
159
|
+
* @default ['meta', 'links']
|
|
160
|
+
*/
|
|
135
161
|
paginatedExtras: ('meta' | 'links' | 'cursor')[] | {
|
|
136
162
|
meta?: string | undefined;
|
|
137
163
|
links?: string | undefined;
|
|
138
164
|
cursor?: string | undefined;
|
|
139
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* @description The base URL to use for generating pagination links in responses.
|
|
168
|
+
* @default 'https://localhost'
|
|
169
|
+
*/
|
|
140
170
|
baseUrl: string;
|
|
171
|
+
/**
|
|
172
|
+
* @description The query parameter name to use for the page number in paginated requests.
|
|
173
|
+
* @default 'page'
|
|
174
|
+
*/
|
|
141
175
|
pageName: string;
|
|
176
|
+
/**
|
|
177
|
+
* @description An object specifying the keys to use for pagination links in the response. Each property corresponds to a specific pagination link:
|
|
178
|
+
* - first: The key for the link to the first page of results.
|
|
179
|
+
* - last: The key for the link to the last page of results.
|
|
180
|
+
* - prev: The key for the link to the previous page of results.
|
|
181
|
+
* - next: The key for the link to the next page of results.
|
|
182
|
+
* All properties are optional and can be customized to specify the desired keys for pagination links in the response.
|
|
183
|
+
*/
|
|
142
184
|
paginatedLinks: {
|
|
143
185
|
first?: string | undefined;
|
|
144
186
|
last?: string | undefined;
|
|
145
187
|
prev?: string | undefined;
|
|
146
188
|
next?: string | undefined;
|
|
147
189
|
};
|
|
190
|
+
/**
|
|
191
|
+
* @description An object specifying the keys to use for pagination metadata in the response. Each property corresponds to a specific piece of pagination information:
|
|
192
|
+
* - to: The key for the index of the last item in the current page of results.
|
|
193
|
+
* - from: The key for the index of the first item in the current page of results.
|
|
194
|
+
* - links: The key for any additional pagination links included in the response.
|
|
195
|
+
*/
|
|
148
196
|
paginatedMeta: {
|
|
149
197
|
to?: string | undefined;
|
|
150
198
|
from?: string | undefined;
|
|
@@ -155,13 +203,63 @@ interface Config {
|
|
|
155
203
|
last_page?: string | undefined;
|
|
156
204
|
current_page?: string | undefined;
|
|
157
205
|
};
|
|
206
|
+
/**
|
|
207
|
+
* @description An object specifying the keys to use for cursor pagination metadata in the response. Each property corresponds to a specific piece of cursor pagination information:
|
|
208
|
+
* - previous: The key for the cursor value that points to the previous page of results.
|
|
209
|
+
* - next: The key for the cursor value that points to the next page of results.
|
|
210
|
+
* Both properties are optional and can be customized to specify the desired keys for cursor pagination metadata in the response.
|
|
211
|
+
*/
|
|
158
212
|
cursorMeta: {
|
|
159
213
|
previous?: string | undefined;
|
|
160
214
|
next?: string | undefined;
|
|
161
215
|
};
|
|
216
|
+
/**
|
|
217
|
+
* @description An object specifying the structure of the response body for resources. It includes a rootKey property that defines the key under which the resource data will be nested in the response. The rootKey is a string that represents the name of this key in the response body.
|
|
218
|
+
*/
|
|
162
219
|
responseStructure: ResponseStructureConfig;
|
|
220
|
+
/**
|
|
221
|
+
* @description An optional array of additional command classes to be registered with the framework. Each command class should extend the base Command class provided by the '@h3ravel/musket' package. This allows users to easily add custom commands to their application by including them in this array when defining the configuration.
|
|
222
|
+
*/
|
|
163
223
|
extraCommands?: typeof Command<any>[];
|
|
164
224
|
}
|
|
225
|
+
interface ResoraConfig extends Partial<Omit<Config, 'stubs' | 'cursorMeta' | 'paginatedMeta' | 'paginatedLinks' | 'responseStructure'>> {
|
|
226
|
+
/**
|
|
227
|
+
* @description The file names of the various stub templates used for generating resources and configuration.
|
|
228
|
+
* Each property corresponds to a specific type of stub:
|
|
229
|
+
* - config: The stub file for generating the default configuration file.
|
|
230
|
+
* - resource: The stub file for generating a single resource.
|
|
231
|
+
* - collection: The stub file for generating a collection of resources.
|
|
232
|
+
* All properties are required and should be provided as strings representing the file names of the respective stubs.
|
|
233
|
+
*/
|
|
234
|
+
stubs?: Partial<Config['stubs']>;
|
|
235
|
+
/**
|
|
236
|
+
* @description An object specifying the keys to use for cursor pagination metadata in the response. Each property corresponds to a specific piece of cursor pagination information:
|
|
237
|
+
* - previous: The key for the cursor value that points to the previous page of results.
|
|
238
|
+
* - next: The key for the cursor value that points to the next page of results.
|
|
239
|
+
* Both properties are optional and can be customized to specify the desired keys for cursor pagination metadata in the response.
|
|
240
|
+
*/
|
|
241
|
+
cursorMeta?: Partial<Config['cursorMeta']>;
|
|
242
|
+
/**
|
|
243
|
+
* @description An object specifying the keys to use for pagination metadata in the response. Each property corresponds to a specific piece of pagination information:
|
|
244
|
+
* - to: The key for the index of the last item in the current page of results.
|
|
245
|
+
* - from: The key for the index of the first item in the current page of results.
|
|
246
|
+
* - links: The key for any additional pagination links included in the response.
|
|
247
|
+
*/
|
|
248
|
+
paginatedMeta?: Partial<Config['paginatedMeta']>;
|
|
249
|
+
/**
|
|
250
|
+
* @description An object specifying the keys to use for pagination links in the response. Each property corresponds to a specific pagination link:
|
|
251
|
+
* - first: The key for the link to the first page of results.
|
|
252
|
+
* - last: The key for the link to the last page of results.
|
|
253
|
+
* - prev: The key for the link to the previous page of results.
|
|
254
|
+
* - next: The key for the link to the next page of results.
|
|
255
|
+
* All properties are optional and can be customized to specify the desired keys for pagination links in the response.
|
|
256
|
+
*/
|
|
257
|
+
paginatedLinks?: Partial<Config['paginatedLinks']>;
|
|
258
|
+
/**
|
|
259
|
+
* @description An object specifying the structure of the response body for resources. It includes a rootKey property that defines the key under which the resource data will be nested in the response. The rootKey is a string that represents the name of this key in the response body.
|
|
260
|
+
*/
|
|
261
|
+
responseStructure?: Partial<Config['responseStructure']>;
|
|
262
|
+
}
|
|
165
263
|
//#endregion
|
|
166
264
|
//#region src/cli/CliApp.d.ts
|
|
167
265
|
declare class CliApp {
|
|
@@ -644,44 +742,168 @@ declare class GenericResource<R extends NonCollectible | Collectible | ResourceD
|
|
|
644
742
|
}
|
|
645
743
|
//#endregion
|
|
646
744
|
//#region src/utilities/case.d.ts
|
|
745
|
+
/**
|
|
746
|
+
* Splits a string into words based on common delimiters and capitalization patterns.
|
|
747
|
+
* Handles camelCase, PascalCase, snake_case, kebab-case, and space-separated words.
|
|
748
|
+
*
|
|
749
|
+
* @param str
|
|
750
|
+
* @returns
|
|
751
|
+
*/
|
|
647
752
|
declare const splitWords: (str: string) => string[];
|
|
753
|
+
/**
|
|
754
|
+
* Transforms a string to camelCase.
|
|
755
|
+
*
|
|
756
|
+
* @param str
|
|
757
|
+
* @returns
|
|
758
|
+
*/
|
|
648
759
|
declare const toCamelCase: (str: string) => string;
|
|
760
|
+
/**
|
|
761
|
+
* Transforms a string to snake_case.
|
|
762
|
+
*
|
|
763
|
+
* @param str
|
|
764
|
+
* @returns
|
|
765
|
+
*/
|
|
649
766
|
declare const toSnakeCase: (str: string) => string;
|
|
767
|
+
/**
|
|
768
|
+
* Transforms a string to PascalCase.
|
|
769
|
+
*
|
|
770
|
+
* @param str
|
|
771
|
+
* @returns
|
|
772
|
+
*/
|
|
650
773
|
declare const toPascalCase: (str: string) => string;
|
|
774
|
+
/**
|
|
775
|
+
* Transforms a string to kebab-case.
|
|
776
|
+
*
|
|
777
|
+
* @param str
|
|
778
|
+
* @returns
|
|
779
|
+
*/
|
|
651
780
|
declare const toKebabCase: (str: string) => string;
|
|
781
|
+
/**
|
|
782
|
+
* Retrieves the appropriate case transformation function based on the provided style.
|
|
783
|
+
*
|
|
784
|
+
* @param style
|
|
785
|
+
* @returns
|
|
786
|
+
*/
|
|
652
787
|
declare const getCaseTransformer: (style: CaseStyle) => ((key: string) => string);
|
|
788
|
+
/**
|
|
789
|
+
* Transforms the keys of an object (including nested objects and arrays) using
|
|
790
|
+
* the provided transformer function.
|
|
791
|
+
*
|
|
792
|
+
* @param obj
|
|
793
|
+
* @param transformer
|
|
794
|
+
* @returns
|
|
795
|
+
*/
|
|
653
796
|
declare const transformKeys: (obj: any, transformer: (key: string) => string) => any;
|
|
654
797
|
//#endregion
|
|
655
798
|
//#region src/utilities/conditional.d.ts
|
|
656
799
|
declare const CONDITIONAL_ATTRIBUTE_MISSING: unique symbol;
|
|
800
|
+
/**
|
|
801
|
+
* Resolves a value based on a condition. If the condition is falsy, it returns a special symbol indicating that the attribute is missing.
|
|
802
|
+
*
|
|
803
|
+
*
|
|
804
|
+
* @param condition The condition to evaluate.
|
|
805
|
+
* @param value The value or function to resolve if the condition is truthy.
|
|
806
|
+
* @returns The resolved value or a symbol indicating the attribute is missing.
|
|
807
|
+
*/
|
|
657
808
|
declare const resolveWhen: <T>(condition: any, value: T | (() => T)) => T | typeof CONDITIONAL_ATTRIBUTE_MISSING;
|
|
809
|
+
/**
|
|
810
|
+
* Resolves a value only if it is not null or undefined.
|
|
811
|
+
*
|
|
812
|
+
* @param value The value to resolve.
|
|
813
|
+
* @returns The resolved value or a symbol indicating the attribute is missing.
|
|
814
|
+
*/
|
|
658
815
|
declare const resolveWhenNotNull: <T>(value: T | null | undefined) => T | typeof CONDITIONAL_ATTRIBUTE_MISSING;
|
|
816
|
+
/**
|
|
817
|
+
* Conditionally merges object attributes based on a condition.
|
|
818
|
+
*
|
|
819
|
+
* @param condition
|
|
820
|
+
* @param value
|
|
821
|
+
* @returns
|
|
822
|
+
*/
|
|
659
823
|
declare const resolveMergeWhen: <T extends Record<string, any>>(condition: any, value: T | (() => T)) => Partial<T>;
|
|
824
|
+
/**
|
|
825
|
+
* Recursively sanitizes an object or array by removing any attributes that are marked as missing using the special symbol.
|
|
826
|
+
*
|
|
827
|
+
* @param value The value to sanitize.
|
|
828
|
+
* @returns The sanitized value.
|
|
829
|
+
*/
|
|
660
830
|
declare const sanitizeConditionalAttributes: (value: any) => any;
|
|
661
831
|
//#endregion
|
|
662
832
|
//#region src/utilities/config.d.ts
|
|
663
833
|
declare const getDefaultConfig: () => Config;
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
834
|
+
/**
|
|
835
|
+
* Defines the configuration for the application by merging the provided configuration with the default configuration. This function takes a partial configuration object as input and returns a complete configuration object that includes all required properties, using default values for any properties that are not specified in the input.
|
|
836
|
+
*
|
|
837
|
+
* @param config
|
|
838
|
+
* @returns
|
|
839
|
+
*/
|
|
840
|
+
declare const defineConfig: (config: ResoraConfig) => Config;
|
|
667
841
|
//#endregion
|
|
668
842
|
//#region src/utilities/metadata.d.ts
|
|
843
|
+
/**
|
|
844
|
+
* Resolves metadata from a resource instance by checking for a custom `with` method.
|
|
845
|
+
* If the method exists and is different from the base method, it calls it to retrieve metadata.
|
|
846
|
+
* This allows resources to provide additional metadata for response construction.
|
|
847
|
+
*
|
|
848
|
+
* @param instance The resource instance to check for a custom `with` method.
|
|
849
|
+
* @param baseWithMethod The base `with` method to compare against.
|
|
850
|
+
* @returns The resolved metadata or `undefined` if no custom metadata is provided.
|
|
851
|
+
*/
|
|
669
852
|
declare const resolveWithHookMetadata: (instance: any, baseWithMethod: (...args: any[]) => any) => MetaData | undefined;
|
|
670
853
|
//#endregion
|
|
671
854
|
//#region src/utilities/objects.d.ts
|
|
855
|
+
/**
|
|
856
|
+
* Utility functions for working with objects, including type checking, merging, and property manipulation.
|
|
857
|
+
*
|
|
858
|
+
* @param value The value to check.
|
|
859
|
+
* @returns `true` if the value is a plain object, `false` otherwise.
|
|
860
|
+
*/
|
|
672
861
|
declare const isPlainObject: (value: any) => value is Record<string, any>;
|
|
862
|
+
/**
|
|
863
|
+
* Appends extra properties to a response body, ensuring that the main data is wrapped under a specified root key if necessary.
|
|
864
|
+
*
|
|
865
|
+
* @param body The original response body, which can be an object, array, or primitive value.
|
|
866
|
+
* @param extra Extra properties to append to the response body.
|
|
867
|
+
* @param rootKey The root key under which to wrap the main data if necessary.
|
|
868
|
+
* @returns The response body with the extra properties appended.
|
|
869
|
+
*/
|
|
673
870
|
declare const appendRootProperties: (body: any, extra?: Record<string, any> | undefined, rootKey?: string) => any;
|
|
871
|
+
/**
|
|
872
|
+
* Deeply merges two metadata objects, combining nested objects recursively.
|
|
873
|
+
*
|
|
874
|
+
* @param base The base metadata object to merge into.
|
|
875
|
+
* @param incoming The incoming metadata object to merge from.
|
|
876
|
+
* @returns
|
|
877
|
+
*/
|
|
674
878
|
declare const mergeMetadata: (base?: Record<string, any> | undefined, incoming?: Record<string, any> | undefined) => Record<string, any> | undefined;
|
|
675
879
|
//#endregion
|
|
676
880
|
//#region src/utilities/pagination.d.ts
|
|
881
|
+
/**
|
|
882
|
+
* Retrieves the configured keys for pagination extras (meta, links, cursor) based on the application's configuration.
|
|
883
|
+
*
|
|
884
|
+
* @returns An object containing the keys for meta, links, and cursor extras, or `undefined` if not configured.
|
|
885
|
+
*/
|
|
677
886
|
declare const getPaginationExtraKeys: () => {
|
|
678
887
|
metaKey?: string;
|
|
679
888
|
linksKey?: string;
|
|
680
889
|
cursorKey?: string;
|
|
681
890
|
};
|
|
891
|
+
/**
|
|
892
|
+
* Builds pagination extras (meta, links, cursor) for a given resource based on
|
|
893
|
+
* its pagination and cursor properties, using the configured keys for each type of extra.
|
|
894
|
+
*
|
|
895
|
+
* @param resource The resource for which to build pagination extras.
|
|
896
|
+
* @returns An object containing the pagination extras (meta, links, cursor) for the resource.
|
|
897
|
+
*/
|
|
682
898
|
declare const buildPaginationExtras: (resource: any) => Record<string, any>;
|
|
683
899
|
//#endregion
|
|
684
900
|
//#region src/utilities/response.d.ts
|
|
901
|
+
/**
|
|
902
|
+
* Builds a response envelope based on the provided payload,
|
|
903
|
+
* metadata, and configuration options.
|
|
904
|
+
*
|
|
905
|
+
* @param config The configuration object containing payload, metadata, and other options for building the response.
|
|
906
|
+
*/
|
|
685
907
|
declare const buildResponseEnvelope: ({
|
|
686
908
|
payload,
|
|
687
909
|
meta,
|
|
@@ -700,28 +922,177 @@ declare const buildResponseEnvelope: ({
|
|
|
700
922
|
context: Omit<ResponseFactoryContext, "rootKey" | "meta">;
|
|
701
923
|
}) => Record<string, any>;
|
|
702
924
|
//#endregion
|
|
925
|
+
//#region src/utilities/runtime-config.d.ts
|
|
926
|
+
/**
|
|
927
|
+
* Resets the runtime configuration state for testing purposes.
|
|
928
|
+
*
|
|
929
|
+
* @returns
|
|
930
|
+
*/
|
|
931
|
+
declare const resetRuntimeConfigForTests: () => void;
|
|
932
|
+
/**
|
|
933
|
+
* Applies the provided configuration to the global state of the application.
|
|
934
|
+
*
|
|
935
|
+
* @param config The complete configuration object to apply.
|
|
936
|
+
*/
|
|
937
|
+
declare const applyRuntimeConfig: (config: Config) => void;
|
|
938
|
+
/**
|
|
939
|
+
* Loads the runtime configuration by searching for configuration files in the current working directory.
|
|
940
|
+
*
|
|
941
|
+
* @returns
|
|
942
|
+
*/
|
|
943
|
+
declare const loadRuntimeConfig: () => Promise<void>;
|
|
944
|
+
//#endregion
|
|
703
945
|
//#region src/utilities/state.d.ts
|
|
946
|
+
/**
|
|
947
|
+
* Sets the global case style for response keys, which will be applied
|
|
948
|
+
* to all responses unless overridden by individual resource configurations.
|
|
949
|
+
*
|
|
950
|
+
* @param style The case style to set as the global default for response keys.
|
|
951
|
+
*/
|
|
704
952
|
declare const setGlobalCase: (style: CaseStyle | undefined) => void;
|
|
953
|
+
/**
|
|
954
|
+
* Retrieves the global case style for response keys, which is used
|
|
955
|
+
* to determine how keys in responses should be formatted.
|
|
956
|
+
*
|
|
957
|
+
* @returns
|
|
958
|
+
*/
|
|
705
959
|
declare const getGlobalCase: () => CaseStyle | undefined;
|
|
960
|
+
/**
|
|
961
|
+
* Sets the global response structure configuration, which defines how
|
|
962
|
+
* responses should be structured across the application.
|
|
963
|
+
*
|
|
964
|
+
* @param config The response structure configuration object.
|
|
965
|
+
*/
|
|
706
966
|
declare const setGlobalResponseStructure: (config: ResponseStructureConfig | undefined) => void;
|
|
967
|
+
/**
|
|
968
|
+
* Retrieves the global response structure configuration, which
|
|
969
|
+
* defines how responses should be structured across the application.
|
|
970
|
+
*
|
|
971
|
+
* @returns
|
|
972
|
+
*/
|
|
707
973
|
declare const getGlobalResponseStructure: () => ResponseStructureConfig | undefined;
|
|
974
|
+
/**
|
|
975
|
+
* Sets the global response root key, which is the key under which
|
|
976
|
+
* the main data will be nested in responses if wrapping is enabled.
|
|
977
|
+
*
|
|
978
|
+
* @param rootKey The root key to set for response data.
|
|
979
|
+
*/
|
|
708
980
|
declare const setGlobalResponseRootKey: (rootKey: string | undefined) => void;
|
|
981
|
+
/**
|
|
982
|
+
* Sets the global response wrap option, which determines whether responses
|
|
983
|
+
* should be wrapped in a root key or returned unwrapped when possible.
|
|
984
|
+
*
|
|
985
|
+
* @param wrap The wrap option to set for responses.
|
|
986
|
+
*/
|
|
709
987
|
declare const setGlobalResponseWrap: (wrap: boolean | undefined) => void;
|
|
988
|
+
/**
|
|
989
|
+
* Retrieves the global response wrap option, which indicates whether responses
|
|
990
|
+
* should be wrapped in a root key or returned unwrapped when possible.
|
|
991
|
+
*
|
|
992
|
+
* @returns
|
|
993
|
+
*/
|
|
710
994
|
declare const getGlobalResponseWrap: () => boolean | undefined;
|
|
995
|
+
/**
|
|
996
|
+
* Retrieves the global response root key, which is the key under which the main
|
|
997
|
+
* data will be nested in responses if wrapping is enabled.
|
|
998
|
+
*
|
|
999
|
+
* @returns
|
|
1000
|
+
*/
|
|
711
1001
|
declare const getGlobalResponseRootKey: () => string | undefined;
|
|
1002
|
+
/**
|
|
1003
|
+
* Sets the global response factory, which is a custom function that can be used
|
|
1004
|
+
* to produce a completely custom response structure based on the provided
|
|
1005
|
+
* payload and context.
|
|
1006
|
+
*
|
|
1007
|
+
* @param factory The response factory function to set as the global default for response construction.
|
|
1008
|
+
*/
|
|
712
1009
|
declare const setGlobalResponseFactory: (factory: ResponseFactory | undefined) => void;
|
|
1010
|
+
/**
|
|
1011
|
+
* Retrieves the global response factory, which is a custom function that
|
|
1012
|
+
* can be used to produce a completely custom response structure based on
|
|
1013
|
+
* the provided payload and context.
|
|
1014
|
+
*
|
|
1015
|
+
* @returns
|
|
1016
|
+
*/
|
|
713
1017
|
declare const getGlobalResponseFactory: () => ResponseFactory | undefined;
|
|
1018
|
+
/**
|
|
1019
|
+
* Sets the global paginated extras configuration, which defines the keys
|
|
1020
|
+
* to use for pagination metadata, links, and cursor information in paginated responses.
|
|
1021
|
+
*
|
|
1022
|
+
* @param extras The paginated extras configuration object.
|
|
1023
|
+
*/
|
|
714
1024
|
declare const setGlobalPaginatedExtras: (extras: Config["paginatedExtras"]) => void;
|
|
1025
|
+
/**
|
|
1026
|
+
* Retrieves the global paginated extras configuration, which defines the keys to use for pagination metadata, links, and cursor information in paginated responses.
|
|
1027
|
+
*
|
|
1028
|
+
* @returns
|
|
1029
|
+
*/
|
|
715
1030
|
declare const getGlobalPaginatedExtras: () => Config["paginatedExtras"];
|
|
1031
|
+
/**
|
|
1032
|
+
* Sets the global paginated links configuration, which defines the keys to
|
|
1033
|
+
* use for pagination links (first, last, prev, next) in paginated responses.
|
|
1034
|
+
*
|
|
1035
|
+
* @param links The paginated links configuration object.
|
|
1036
|
+
*/
|
|
716
1037
|
declare const setGlobalPaginatedLinks: (links: Config["paginatedLinks"]) => void;
|
|
1038
|
+
/**
|
|
1039
|
+
* Retrieves the global paginated links configuration, which defines the keys to use for pagination links (first, last, prev, next) in paginated responses.
|
|
1040
|
+
*
|
|
1041
|
+
* @returns
|
|
1042
|
+
*/
|
|
717
1043
|
declare const getGlobalPaginatedLinks: () => Config["paginatedLinks"];
|
|
1044
|
+
/**
|
|
1045
|
+
* Sets the global base URL, which is used for generating pagination links in responses.
|
|
1046
|
+
*
|
|
1047
|
+
* @param baseUrl The base URL to set for pagination link generation.
|
|
1048
|
+
*/
|
|
718
1049
|
declare const setGlobalBaseUrl: (baseUrl: Config["baseUrl"]) => void;
|
|
1050
|
+
/**
|
|
1051
|
+
* Retrieves the global base URL, which is used for generating pagination links in responses.
|
|
1052
|
+
*
|
|
1053
|
+
* @returns
|
|
1054
|
+
*/
|
|
719
1055
|
declare const getGlobalBaseUrl: () => Config["baseUrl"];
|
|
1056
|
+
/**
|
|
1057
|
+
* Sets the global page name, which is the query parameter name used for the page number in paginated requests and link generation.
|
|
1058
|
+
*
|
|
1059
|
+
* @param pageName
|
|
1060
|
+
*/
|
|
720
1061
|
declare const setGlobalPageName: (pageName: Config["pageName"]) => void;
|
|
1062
|
+
/**
|
|
1063
|
+
* Retrieves the global page name, which is the query parameter name
|
|
1064
|
+
* used for the page number in paginated requests and link generation.
|
|
1065
|
+
*
|
|
1066
|
+
* @returns
|
|
1067
|
+
*/
|
|
721
1068
|
declare const getGlobalPageName: () => Config["pageName"];
|
|
1069
|
+
/**
|
|
1070
|
+
* Retrieves the keys to use for pagination extras (meta, links, cursor) based
|
|
1071
|
+
* on the global configuration.
|
|
1072
|
+
*
|
|
1073
|
+
* @param meta Whether to include pagination metadata in the response.
|
|
1074
|
+
*/
|
|
722
1075
|
declare const setGlobalPaginatedMeta: (meta: Config["paginatedMeta"]) => void;
|
|
1076
|
+
/**
|
|
1077
|
+
* Retrieves the keys to use for pagination extras (meta, links, cursor) based
|
|
1078
|
+
* on the global configuration.
|
|
1079
|
+
*
|
|
1080
|
+
* @returns The global pagination metadata configuration.
|
|
1081
|
+
*/
|
|
723
1082
|
declare const getGlobalPaginatedMeta: () => Config["paginatedMeta"];
|
|
1083
|
+
/**
|
|
1084
|
+
* Sets the global cursor meta configuration, which defines the keys to use
|
|
1085
|
+
* for cursor pagination metadata (previous, next) in responses.
|
|
1086
|
+
*
|
|
1087
|
+
* @param meta The cursor meta configuration object.
|
|
1088
|
+
*/
|
|
724
1089
|
declare const setGlobalCursorMeta: (meta: Config["cursorMeta"]) => void;
|
|
1090
|
+
/**
|
|
1091
|
+
* Retrieves the keys to use for cursor pagination metadata (previous, next) in
|
|
1092
|
+
* responses based on the global configuration.
|
|
1093
|
+
*
|
|
1094
|
+
* @returns The global cursor pagination metadata configuration.
|
|
1095
|
+
*/
|
|
725
1096
|
declare const getGlobalCursorMeta: () => Config["cursorMeta"];
|
|
726
1097
|
//#endregion
|
|
727
|
-
export { ApiResource, CONDITIONAL_ATTRIBUTE_MISSING, CaseStyle, CliApp, Collectible, CollectionBody, Config, Cursor, GenericBody, GenericResource, InitCommand, MakeResource, MetaData, NonCollectible, PaginatedMetaData, Pagination, Resource, ResourceBody, ResourceCollection, ResourceData, ResourceDef, ResponseData, ResponseDataCollection, ResponseFactory, ResponseFactoryContext, ResponseKind, ResponseStructureConfig, ServerResponse, appendRootProperties, buildPaginationExtras, buildResponseEnvelope, defineConfig, getCaseTransformer, getDefaultConfig, getGlobalBaseUrl, getGlobalCase, getGlobalCursorMeta, getGlobalPageName, getGlobalPaginatedExtras, getGlobalPaginatedLinks, getGlobalPaginatedMeta, getGlobalResponseFactory, getGlobalResponseRootKey, getGlobalResponseStructure, getGlobalResponseWrap, getPaginationExtraKeys, isPlainObject, mergeMetadata, resolveMergeWhen, resolveWhen, resolveWhenNotNull, resolveWithHookMetadata, sanitizeConditionalAttributes, setGlobalBaseUrl, setGlobalCase, setGlobalCursorMeta, setGlobalPageName, setGlobalPaginatedExtras, setGlobalPaginatedLinks, setGlobalPaginatedMeta, setGlobalResponseFactory, setGlobalResponseRootKey, setGlobalResponseStructure, setGlobalResponseWrap, splitWords, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, transformKeys };
|
|
1098
|
+
export { ApiResource, CONDITIONAL_ATTRIBUTE_MISSING, CaseStyle, CliApp, Collectible, CollectionBody, Config, Cursor, GenericBody, GenericResource, InitCommand, MakeResource, MetaData, NonCollectible, PaginatedMetaData, Pagination, ResoraConfig, Resource, ResourceBody, ResourceCollection, ResourceData, ResourceDef, ResponseData, ResponseDataCollection, ResponseFactory, ResponseFactoryContext, ResponseKind, ResponseStructureConfig, ServerResponse, appendRootProperties, applyRuntimeConfig, buildPaginationExtras, buildResponseEnvelope, defineConfig, getCaseTransformer, getDefaultConfig, getGlobalBaseUrl, getGlobalCase, getGlobalCursorMeta, getGlobalPageName, getGlobalPaginatedExtras, getGlobalPaginatedLinks, getGlobalPaginatedMeta, getGlobalResponseFactory, getGlobalResponseRootKey, getGlobalResponseStructure, getGlobalResponseWrap, getPaginationExtraKeys, isPlainObject, loadRuntimeConfig, mergeMetadata, resetRuntimeConfigForTests, resolveMergeWhen, resolveWhen, resolveWhenNotNull, resolveWithHookMetadata, sanitizeConditionalAttributes, setGlobalBaseUrl, setGlobalCase, setGlobalCursorMeta, setGlobalPageName, setGlobalPaginatedExtras, setGlobalPaginatedLinks, setGlobalPaginatedMeta, setGlobalResponseFactory, setGlobalResponseRootKey, setGlobalResponseStructure, setGlobalResponseWrap, splitWords, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, transformKeys };
|