nucleus-core-ts 0.10.138 → 0.10.139
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/dist/.build-ok
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.10.
|
|
1
|
+
0.10.139
|
|
@@ -156,7 +156,11 @@ export function NucleusEntityShowcase({ entity, apiActions, title, description,
|
|
|
156
156
|
const refTable = column.references.table;
|
|
157
157
|
if (loadedRefsRef.current.has(refTable)) return;
|
|
158
158
|
loadedRefsRef.current.add(refTable);
|
|
159
|
-
|
|
159
|
+
// The generator's own spelling (toUpperSnakeCase): an underscore where a
|
|
160
|
+
// lower-case letter meets an upper-case one. Plain toUpperCase() named a
|
|
161
|
+
// key the runtime never registers for a camelCase table
|
|
162
|
+
// (verificationFlows -> GET_VERIFICATIONFLOWS), so its options never loaded.
|
|
163
|
+
const endpointKey = `GET_${refTable.replace(/([a-z])([A-Z])/g, '$1_$2').toUpperCase()}`;
|
|
160
164
|
const action = apiActions[endpointKey];
|
|
161
165
|
if (action) {
|
|
162
166
|
action.start({
|
|
@@ -2641,7 +2641,7 @@ export type EntityRecord = Record<string, unknown>;
|
|
|
2641
2641
|
export type GenerateEntityEndpoints<TTable extends NucleusTable> = {
|
|
2642
2642
|
[K in EntityEndpointKey<TTable['table_name'], 'GET'>]: EndpointDefinition<StandardQueryParams, ListResponse<EntityRecord>, BaseErrorResponse>;
|
|
2643
2643
|
} & {
|
|
2644
|
-
[K in `GET_${
|
|
2644
|
+
[K in `GET_${ToUpperSnake<Singularize<TTable['table_name']>>}_BY_ID`]: EndpointDefinition<{
|
|
2645
2645
|
id: string;
|
|
2646
2646
|
}, SingleResponse<EntityRecord>, BaseErrorResponse>;
|
|
2647
2647
|
} & {
|
|
@@ -2747,8 +2747,8 @@ export interface ApiCallerConfig<TConfig extends NucleusConfigOptions, TExtra ex
|
|
|
2747
2747
|
type ExtractTableNames<T extends readonly {
|
|
2748
2748
|
table_name: string;
|
|
2749
2749
|
}[]> = T[number]['table_name'];
|
|
2750
|
-
type GenerateEntityEndpointKeys<TTableName extends string> = `GET_${
|
|
2751
|
-
type GenerateBulkEndpointKeys<TTableName extends string> = `BULK_ADD_${
|
|
2750
|
+
type GenerateEntityEndpointKeys<TTableName extends string> = `GET_${ToUpperSnake<TTableName>}` | `GET_${ToUpperSnake<Singularize<TTableName>>}_BY_ID` | `GET_${ToUpperSnake<TTableName>}_DISTINCT` | `ADD_${ToUpperSnake<Singularize<TTableName>>}` | `UPDATE_${ToUpperSnake<Singularize<TTableName>>}` | `PATCH_${ToUpperSnake<Singularize<TTableName>>}` | `DELETE_${ToUpperSnake<Singularize<TTableName>>}`;
|
|
2751
|
+
type GenerateBulkEndpointKeys<TTableName extends string> = `BULK_ADD_${ToUpperSnake<TTableName>}` | `BULK_UPDATE_${ToUpperSnake<TTableName>}` | `BULK_DELETE_${ToUpperSnake<TTableName>}`;
|
|
2752
2752
|
type EntityEndpointDefinitionFor<TKey extends string> = TKey extends `GET_${string}_BY_ID` ? EndpointDefinition<{
|
|
2753
2753
|
id: string;
|
|
2754
2754
|
}, SingleResponse<EntityRecord>, BaseErrorResponse> : TKey extends `GET_${string}_DISTINCT` ? EndpointDefinition<{
|
|
@@ -2859,35 +2859,35 @@ type EntityConstraint = readonly {
|
|
|
2859
2859
|
is_form_data?: boolean;
|
|
2860
2860
|
}[];
|
|
2861
2861
|
type GetListEndpoints<TEntities extends EntityConstraint> = {
|
|
2862
|
-
[TN in ExtractTableNames<TEntities> as `GET_${
|
|
2862
|
+
[TN in ExtractTableNames<TEntities> as `GET_${ToUpperSnake<TN>}`]: EndpointDefinition<StandardQueryParams | undefined, ListResponse<EntityFromConfig<FindEntityByName<TEntities, TN>>>, BaseErrorResponse>;
|
|
2863
2863
|
};
|
|
2864
2864
|
type GetByIdEndpoints<TEntities extends EntityConstraint> = {
|
|
2865
|
-
[TN in ExtractTableNames<TEntities> as `GET_${
|
|
2865
|
+
[TN in ExtractTableNames<TEntities> as `GET_${ToUpperSnake<Singularize<TN>>}_BY_ID`]: EndpointDefinition<{
|
|
2866
2866
|
id: string;
|
|
2867
2867
|
}, SingleResponse<EntityFromConfig<FindEntityByName<TEntities, TN>>>, BaseErrorResponse>;
|
|
2868
2868
|
};
|
|
2869
2869
|
type GetDistinctEndpoints<TEntities extends EntityConstraint> = {
|
|
2870
|
-
[TN in ExtractTableNames<TEntities> as `GET_${
|
|
2870
|
+
[TN in ExtractTableNames<TEntities> as `GET_${ToUpperSnake<TN>}_DISTINCT`]: EndpointDefinition<{
|
|
2871
2871
|
field: string;
|
|
2872
2872
|
}, StandardReturn<{
|
|
2873
2873
|
value: unknown;
|
|
2874
2874
|
}[]>, BaseErrorResponse>;
|
|
2875
2875
|
};
|
|
2876
2876
|
type AddEndpoints<TEntities extends EntityConstraint> = {
|
|
2877
|
-
[TN in ExtractTableNames<TEntities> as `ADD_${
|
|
2877
|
+
[TN in ExtractTableNames<TEntities> as `ADD_${ToUpperSnake<Singularize<TN>>}`]: EndpointDefinition<FormData | Partial<EntityFromConfig<FindEntityByName<TEntities, TN>>>, MutationResponse<EntityFromConfig<FindEntityByName<TEntities, TN>>>, BaseErrorResponse>;
|
|
2878
2878
|
};
|
|
2879
2879
|
type UpdateEndpoints<TEntities extends EntityConstraint> = {
|
|
2880
|
-
[TN in ExtractTableNames<TEntities> as `UPDATE_${
|
|
2880
|
+
[TN in ExtractTableNames<TEntities> as `UPDATE_${ToUpperSnake<Singularize<TN>>}`]: EndpointDefinition<FormData | (Partial<EntityFromConfig<FindEntityByName<TEntities, TN>>> & {
|
|
2881
2881
|
id: string;
|
|
2882
2882
|
}), MutationResponse<EntityFromConfig<FindEntityByName<TEntities, TN>>>, BaseErrorResponse>;
|
|
2883
2883
|
};
|
|
2884
2884
|
type PatchEndpoints<TEntities extends EntityConstraint> = {
|
|
2885
|
-
[TN in ExtractTableNames<TEntities> as `PATCH_${
|
|
2885
|
+
[TN in ExtractTableNames<TEntities> as `PATCH_${ToUpperSnake<Singularize<TN>>}`]: EndpointDefinition<Partial<EntityFromConfig<FindEntityByName<TEntities, TN>>> & {
|
|
2886
2886
|
id: string;
|
|
2887
2887
|
}, MutationResponse<EntityFromConfig<FindEntityByName<TEntities, TN>>>, BaseErrorResponse>;
|
|
2888
2888
|
};
|
|
2889
2889
|
type DeleteEndpoints<TEntities extends EntityConstraint> = {
|
|
2890
|
-
[TN in ExtractTableNames<TEntities> as `DELETE_${
|
|
2890
|
+
[TN in ExtractTableNames<TEntities> as `DELETE_${ToUpperSnake<Singularize<TN>>}`]: EndpointDefinition<{
|
|
2891
2891
|
id: string;
|
|
2892
2892
|
}, DeleteResponse, BaseErrorResponse>;
|
|
2893
2893
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nucleus-core-ts",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.139",
|
|
4
4
|
"description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
|
|
5
5
|
"author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|