payload 3.66.0 → 3.67.0-internal.1ea538b
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/auth/operations/forgotPassword.d.ts.map +1 -1
- package/dist/auth/operations/forgotPassword.js +7 -12
- package/dist/auth/operations/forgotPassword.js.map +1 -1
- package/dist/auth/operations/login.d.ts.map +1 -1
- package/dist/auth/operations/login.js +7 -12
- package/dist/auth/operations/login.js.map +1 -1
- package/dist/auth/operations/refresh.d.ts.map +1 -1
- package/dist/auth/operations/refresh.js +7 -12
- package/dist/auth/operations/refresh.js.map +1 -1
- package/dist/auth/operations/resetPassword.d.ts.map +1 -1
- package/dist/auth/operations/resetPassword.js +7 -12
- package/dist/auth/operations/resetPassword.js.map +1 -1
- package/dist/auth/operations/unlock.d.ts.map +1 -1
- package/dist/auth/operations/unlock.js +14 -1
- package/dist/auth/operations/unlock.js.map +1 -1
- package/dist/collections/config/sanitize.d.ts.map +1 -1
- package/dist/collections/config/sanitize.js +2 -0
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/config/types.d.ts +7 -19
- package/dist/collections/config/types.d.ts.map +1 -1
- package/dist/collections/config/types.js.map +1 -1
- package/dist/collections/operations/count.d.ts.map +1 -1
- package/dist/collections/operations/count.js +7 -12
- package/dist/collections/operations/count.js.map +1 -1
- package/dist/collections/operations/countVersions.d.ts.map +1 -1
- package/dist/collections/operations/countVersions.js +7 -12
- package/dist/collections/operations/countVersions.js.map +1 -1
- package/dist/collections/operations/create.d.ts.map +1 -1
- package/dist/collections/operations/create.js +10 -14
- package/dist/collections/operations/create.js.map +1 -1
- package/dist/collections/operations/delete.d.ts.map +1 -1
- package/dist/collections/operations/delete.js +9 -13
- package/dist/collections/operations/delete.js.map +1 -1
- package/dist/collections/operations/deleteByID.d.ts.map +1 -1
- package/dist/collections/operations/deleteByID.js +9 -13
- package/dist/collections/operations/deleteByID.js.map +1 -1
- package/dist/collections/operations/find.d.ts.map +1 -1
- package/dist/collections/operations/find.js +9 -13
- package/dist/collections/operations/find.js.map +1 -1
- package/dist/collections/operations/findByID.d.ts.map +1 -1
- package/dist/collections/operations/findByID.js +22 -26
- package/dist/collections/operations/findByID.js.map +1 -1
- package/dist/collections/operations/findDistinct.d.ts.map +1 -1
- package/dist/collections/operations/findDistinct.js +7 -12
- package/dist/collections/operations/findDistinct.js.map +1 -1
- package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
- package/dist/collections/operations/findVersionByID.js +20 -1
- package/dist/collections/operations/findVersionByID.js.map +1 -1
- package/dist/collections/operations/findVersions.d.ts.map +1 -1
- package/dist/collections/operations/findVersions.js +24 -5
- package/dist/collections/operations/findVersions.js.map +1 -1
- package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
- package/dist/collections/operations/restoreVersion.js +9 -13
- package/dist/collections/operations/restoreVersion.js.map +1 -1
- package/dist/collections/operations/update.d.ts.map +1 -1
- package/dist/collections/operations/update.js +9 -13
- package/dist/collections/operations/update.js.map +1 -1
- package/dist/collections/operations/updateByID.d.ts.map +1 -1
- package/dist/collections/operations/updateByID.js +7 -12
- package/dist/collections/operations/updateByID.js.map +1 -1
- package/dist/collections/operations/utilities/buildAfterOperation.d.ts +6 -0
- package/dist/collections/operations/utilities/buildAfterOperation.d.ts.map +1 -0
- package/dist/collections/operations/{utils.js → utilities/buildAfterOperation.js} +1 -1
- package/dist/collections/operations/utilities/buildAfterOperation.js.map +1 -0
- package/dist/collections/operations/utilities/buildBeforeOperation.d.ts +47 -0
- package/dist/collections/operations/utilities/buildBeforeOperation.d.ts.map +1 -0
- package/dist/collections/operations/utilities/buildBeforeOperation.js +25 -0
- package/dist/collections/operations/utilities/buildBeforeOperation.js.map +1 -0
- package/dist/collections/operations/utilities/types.d.ts +216 -0
- package/dist/collections/operations/utilities/types.d.ts.map +1 -0
- package/dist/collections/operations/utilities/types.js +23 -0
- package/dist/collections/operations/utilities/types.js.map +1 -0
- package/dist/collections/operations/utilities/update.d.ts.map +1 -1
- package/dist/collections/operations/utilities/update.js +4 -2
- package/dist/collections/operations/utilities/update.js.map +1 -1
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/config/sanitize.js +2 -2
- package/dist/config/sanitize.js.map +1 -1
- package/dist/exports/shared.d.ts +1 -0
- package/dist/exports/shared.d.ts.map +1 -1
- package/dist/exports/shared.js +1 -0
- package/dist/exports/shared.js.map +1 -1
- package/dist/fields/baseFields/slug/generateSlug.d.ts.map +1 -1
- package/dist/fields/baseFields/slug/generateSlug.js +2 -2
- package/dist/fields/baseFields/slug/generateSlug.js.map +1 -1
- package/dist/fields/config/types.d.ts +2 -0
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/globals/config/types.d.ts +1 -1
- package/dist/globals/config/types.d.ts.map +1 -1
- package/dist/globals/config/types.js.map +1 -1
- package/dist/globals/operations/findOne.d.ts.map +1 -1
- package/dist/globals/operations/findOne.js +4 -3
- package/dist/globals/operations/findOne.js.map +1 -1
- package/dist/globals/operations/update.d.ts.map +1 -1
- package/dist/globals/operations/update.js +3 -2
- package/dist/globals/operations/update.js.map +1 -1
- package/dist/index.bundled.d.ts +200 -119
- package/dist/utilities/getVersionsConfig.d.ts +37 -0
- package/dist/utilities/getVersionsConfig.d.ts.map +1 -0
- package/dist/utilities/getVersionsConfig.js +44 -0
- package/dist/utilities/getVersionsConfig.js.map +1 -0
- package/dist/versions/buildCollectionFields.d.ts.map +1 -1
- package/dist/versions/buildCollectionFields.js +3 -2
- package/dist/versions/buildCollectionFields.js.map +1 -1
- package/dist/versions/buildGlobalFields.d.ts.map +1 -1
- package/dist/versions/buildGlobalFields.js +3 -2
- package/dist/versions/buildGlobalFields.js.map +1 -1
- package/dist/versions/getLatestCollectionVersion.d.ts.map +1 -1
- package/dist/versions/getLatestCollectionVersion.js +3 -1
- package/dist/versions/getLatestCollectionVersion.js.map +1 -1
- package/dist/versions/getLatestGlobalVersion.d.ts.map +1 -1
- package/dist/versions/getLatestGlobalVersion.js +3 -2
- package/dist/versions/getLatestGlobalVersion.js.map +1 -1
- package/dist/versions/saveVersion.d.ts.map +1 -1
- package/dist/versions/saveVersion.js +2 -1
- package/dist/versions/saveVersion.js.map +1 -1
- package/package.json +2 -2
- package/dist/collections/operations/utils.d.ts +0 -105
- package/dist/collections/operations/utils.d.ts.map +0 -1
- package/dist/collections/operations/utils.js.map +0 -1
package/dist/index.bundled.d.ts
CHANGED
|
@@ -2094,7 +2094,7 @@ interface SanitizedGlobalConfig extends Omit<DeepRequired<GlobalConfig>, 'endpoi
|
|
|
2094
2094
|
*/
|
|
2095
2095
|
flattenedFields: FlattenedField$1[];
|
|
2096
2096
|
slug: GlobalSlug;
|
|
2097
|
-
versions: SanitizedGlobalVersions;
|
|
2097
|
+
versions: false | SanitizedGlobalVersions | undefined;
|
|
2098
2098
|
}
|
|
2099
2099
|
type Globals = {
|
|
2100
2100
|
config: SanitizedGlobalConfig[];
|
|
@@ -2915,6 +2915,8 @@ type SharedUploadPropertiesClient = FieldBaseClient & Pick<SharedUploadPropertie
|
|
|
2915
2915
|
type UploadAdmin = {
|
|
2916
2916
|
allowCreate?: boolean;
|
|
2917
2917
|
components?: {
|
|
2918
|
+
afterInput?: CustomComponent[];
|
|
2919
|
+
beforeInput?: CustomComponent[];
|
|
2918
2920
|
Error?: CustomComponent<RelationshipFieldErrorClientComponent | RelationshipFieldErrorServerComponent>;
|
|
2919
2921
|
Label?: CustomComponent<RelationshipFieldLabelClientComponent | RelationshipFieldLabelServerComponent>;
|
|
2920
2922
|
} & FieldAdmin['components'];
|
|
@@ -7896,7 +7898,15 @@ type Arguments$m = {
|
|
|
7896
7898
|
};
|
|
7897
7899
|
declare const resetPasswordOperation: <TSlug extends CollectionSlug>(args: Arguments$m) => Promise<Result$1>;
|
|
7898
7900
|
|
|
7899
|
-
type Arguments$l = {
|
|
7901
|
+
type Arguments$l<TSlug extends CollectionSlug> = {
|
|
7902
|
+
collection: Collection;
|
|
7903
|
+
data: AuthOperationsFromCollectionSlug<TSlug>['unlock'];
|
|
7904
|
+
overrideAccess?: boolean;
|
|
7905
|
+
req: PayloadRequest;
|
|
7906
|
+
};
|
|
7907
|
+
declare const unlockOperation: <TSlug extends CollectionSlug>(args: Arguments$l<TSlug>) => Promise<boolean>;
|
|
7908
|
+
|
|
7909
|
+
type Arguments$k = {
|
|
7900
7910
|
collection: Collection;
|
|
7901
7911
|
disableErrors?: boolean;
|
|
7902
7912
|
overrideAccess?: boolean;
|
|
@@ -7904,22 +7914,22 @@ type Arguments$l = {
|
|
|
7904
7914
|
trash?: boolean;
|
|
7905
7915
|
where?: Where;
|
|
7906
7916
|
};
|
|
7907
|
-
declare const countOperation: <TSlug extends CollectionSlug>(incomingArgs: Arguments$
|
|
7917
|
+
declare const countOperation: <TSlug extends CollectionSlug>(incomingArgs: Arguments$k) => Promise<{
|
|
7908
7918
|
totalDocs: number;
|
|
7909
7919
|
}>;
|
|
7910
7920
|
|
|
7911
|
-
type Arguments$
|
|
7921
|
+
type Arguments$j = {
|
|
7912
7922
|
collection: Collection;
|
|
7913
7923
|
disableErrors?: boolean;
|
|
7914
7924
|
overrideAccess?: boolean;
|
|
7915
7925
|
req?: PayloadRequest;
|
|
7916
7926
|
where?: Where;
|
|
7917
7927
|
};
|
|
7918
|
-
declare const countVersionsOperation: <TSlug extends CollectionSlug>(incomingArgs: Arguments$
|
|
7928
|
+
declare const countVersionsOperation: <TSlug extends CollectionSlug>(incomingArgs: Arguments$j) => Promise<{
|
|
7919
7929
|
totalDocs: number;
|
|
7920
7930
|
}>;
|
|
7921
7931
|
|
|
7922
|
-
type Arguments$
|
|
7932
|
+
type Arguments$i<TSlug extends CollectionSlug> = {
|
|
7923
7933
|
autosave?: boolean;
|
|
7924
7934
|
collection: Collection;
|
|
7925
7935
|
data: RequiredDataFromCollectionSlug<TSlug>;
|
|
@@ -7937,9 +7947,9 @@ type Arguments$j<TSlug extends CollectionSlug> = {
|
|
|
7937
7947
|
selectedLocales?: string[];
|
|
7938
7948
|
showHiddenFields?: boolean;
|
|
7939
7949
|
};
|
|
7940
|
-
declare const createOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: Arguments$
|
|
7950
|
+
declare const createOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: Arguments$i<TSlug>) => Promise<TransformCollectionWithSelect<TSlug, TSelect>>;
|
|
7941
7951
|
|
|
7942
|
-
type Arguments$
|
|
7952
|
+
type Arguments$h = {
|
|
7943
7953
|
collection: Collection;
|
|
7944
7954
|
depth?: number;
|
|
7945
7955
|
disableTransaction?: boolean;
|
|
@@ -7952,9 +7962,9 @@ type Arguments$i = {
|
|
|
7952
7962
|
trash?: boolean;
|
|
7953
7963
|
where: Where;
|
|
7954
7964
|
};
|
|
7955
|
-
declare const deleteOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: Arguments$
|
|
7965
|
+
declare const deleteOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: Arguments$h) => Promise<BulkOperationResult<TSlug, TSelect>>;
|
|
7956
7966
|
|
|
7957
|
-
type Arguments$
|
|
7967
|
+
type Arguments$g = {
|
|
7958
7968
|
collection: Collection;
|
|
7959
7969
|
depth?: number;
|
|
7960
7970
|
disableTransaction?: boolean;
|
|
@@ -7967,9 +7977,9 @@ type Arguments$h = {
|
|
|
7967
7977
|
showHiddenFields?: boolean;
|
|
7968
7978
|
trash?: boolean;
|
|
7969
7979
|
};
|
|
7970
|
-
declare const deleteByIDOperation: <TSlug extends CollectionSlug, TSelect extends SelectType>(incomingArgs: Arguments$
|
|
7980
|
+
declare const deleteByIDOperation: <TSlug extends CollectionSlug, TSelect extends SelectType>(incomingArgs: Arguments$g) => Promise<TransformCollectionWithSelect<TSlug, TSelect>>;
|
|
7971
7981
|
|
|
7972
|
-
type Arguments$
|
|
7982
|
+
type Arguments$f = {
|
|
7973
7983
|
collection: Collection;
|
|
7974
7984
|
currentDepth?: number;
|
|
7975
7985
|
depth?: number;
|
|
@@ -7989,7 +7999,7 @@ type Arguments$g = {
|
|
|
7989
7999
|
trash?: boolean;
|
|
7990
8000
|
where?: Where;
|
|
7991
8001
|
};
|
|
7992
|
-
declare const findOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: Arguments$
|
|
8002
|
+
declare const findOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: Arguments$f) => Promise<PaginatedDocs<TransformCollectionWithSelect<TSlug, TSelect>>>;
|
|
7993
8003
|
|
|
7994
8004
|
type AfterReadArgs<T extends JsonObject> = {
|
|
7995
8005
|
collection: null | SanitizedCollectionConfig;
|
|
@@ -8039,7 +8049,7 @@ type FindByIDArgs = {
|
|
|
8039
8049
|
} & Pick<AfterReadArgs<JsonObject>, 'flattenLocales'>;
|
|
8040
8050
|
declare const findByIDOperation: <TSlug extends CollectionSlug, TDisableErrors extends boolean, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: FindByIDArgs) => Promise<ApplyDisableErrors<TransformCollectionWithSelect<TSlug, TSelect>, TDisableErrors>>;
|
|
8041
8051
|
|
|
8042
|
-
type Arguments$
|
|
8052
|
+
type Arguments$e = {
|
|
8043
8053
|
collection: Collection;
|
|
8044
8054
|
depth?: number;
|
|
8045
8055
|
disableErrors?: boolean;
|
|
@@ -8055,9 +8065,41 @@ type Arguments$f = {
|
|
|
8055
8065
|
trash?: boolean;
|
|
8056
8066
|
where?: Where;
|
|
8057
8067
|
};
|
|
8058
|
-
declare const findDistinctOperation: (incomingArgs: Arguments$
|
|
8068
|
+
declare const findDistinctOperation: (incomingArgs: Arguments$e) => Promise<PaginatedDistinctDocs<Record<string, unknown>>>;
|
|
8059
8069
|
|
|
8060
|
-
type Arguments$
|
|
8070
|
+
type Arguments$d = {
|
|
8071
|
+
collection: Collection;
|
|
8072
|
+
currentDepth?: number;
|
|
8073
|
+
depth?: number;
|
|
8074
|
+
disableErrors?: boolean;
|
|
8075
|
+
id: number | string;
|
|
8076
|
+
overrideAccess?: boolean;
|
|
8077
|
+
populate?: PopulateType;
|
|
8078
|
+
req: PayloadRequest;
|
|
8079
|
+
select?: SelectType;
|
|
8080
|
+
showHiddenFields?: boolean;
|
|
8081
|
+
trash?: boolean;
|
|
8082
|
+
};
|
|
8083
|
+
declare const findVersionByIDOperation$1: <TData extends TypeWithID = any>(args: Arguments$d) => Promise<TypeWithVersion<TData>>;
|
|
8084
|
+
|
|
8085
|
+
type Arguments$c = {
|
|
8086
|
+
collection: Collection;
|
|
8087
|
+
depth?: number;
|
|
8088
|
+
limit?: number;
|
|
8089
|
+
overrideAccess?: boolean;
|
|
8090
|
+
page?: number;
|
|
8091
|
+
pagination?: boolean;
|
|
8092
|
+
populate?: PopulateType;
|
|
8093
|
+
req?: PayloadRequest;
|
|
8094
|
+
select?: SelectType;
|
|
8095
|
+
showHiddenFields?: boolean;
|
|
8096
|
+
sort?: Sort;
|
|
8097
|
+
trash?: boolean;
|
|
8098
|
+
where?: Where;
|
|
8099
|
+
};
|
|
8100
|
+
declare const findVersionsOperation$1: <TData extends TypeWithVersion<TData>>(args: Arguments$c) => Promise<PaginatedDocs<TData>>;
|
|
8101
|
+
|
|
8102
|
+
type Arguments$b<TSlug extends CollectionSlug> = {
|
|
8061
8103
|
autosave?: boolean;
|
|
8062
8104
|
collection: Collection;
|
|
8063
8105
|
data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>;
|
|
@@ -8083,9 +8125,9 @@ type Arguments$e<TSlug extends CollectionSlug> = {
|
|
|
8083
8125
|
trash?: boolean;
|
|
8084
8126
|
where: Where;
|
|
8085
8127
|
};
|
|
8086
|
-
declare const updateOperation$1: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: Arguments$
|
|
8128
|
+
declare const updateOperation$1: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: Arguments$b<TSlug>) => Promise<BulkOperationResult<TSlug, TSelect>>;
|
|
8087
8129
|
|
|
8088
|
-
type Arguments$
|
|
8130
|
+
type Arguments$a<TSlug extends CollectionSlug> = {
|
|
8089
8131
|
autosave?: boolean;
|
|
8090
8132
|
collection: Collection;
|
|
8091
8133
|
data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>;
|
|
@@ -8104,9 +8146,9 @@ type Arguments$d<TSlug extends CollectionSlug> = {
|
|
|
8104
8146
|
showHiddenFields?: boolean;
|
|
8105
8147
|
trash?: boolean;
|
|
8106
8148
|
};
|
|
8107
|
-
declare const updateByIDOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug> = SelectType>(incomingArgs: Arguments$
|
|
8149
|
+
declare const updateByIDOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug> = SelectType>(incomingArgs: Arguments$a<TSlug>) => Promise<TransformCollectionWithSelect<TSlug, TSelect>>;
|
|
8108
8150
|
|
|
8109
|
-
type
|
|
8151
|
+
type OperationMap<TOperationGeneric extends CollectionSlug> = {
|
|
8110
8152
|
count: typeof countOperation<TOperationGeneric>;
|
|
8111
8153
|
countVersions: typeof countVersionsOperation<TOperationGeneric>;
|
|
8112
8154
|
create: typeof createOperation<TOperationGeneric, SelectFromCollectionSlug<TOperationGeneric>>;
|
|
@@ -8115,11 +8157,14 @@ type AfterOperationMap<TOperationGeneric extends CollectionSlug> = {
|
|
|
8115
8157
|
find: typeof findOperation<TOperationGeneric, SelectFromCollectionSlug<TOperationGeneric>>;
|
|
8116
8158
|
findByID: typeof findByIDOperation<TOperationGeneric, boolean, SelectFromCollectionSlug<TOperationGeneric>>;
|
|
8117
8159
|
findDistinct: typeof findDistinctOperation;
|
|
8160
|
+
findVersionByID: typeof findVersionByIDOperation$1;
|
|
8161
|
+
findVersions: typeof findVersionsOperation$1;
|
|
8118
8162
|
forgotPassword: typeof forgotPasswordOperation;
|
|
8119
8163
|
login: typeof loginOperation<TOperationGeneric>;
|
|
8120
8164
|
refresh: typeof refreshOperation;
|
|
8121
8165
|
resetPassword: typeof resetPasswordOperation<TOperationGeneric>;
|
|
8122
8166
|
restoreVersion: typeof restoreVersionOperation$1;
|
|
8167
|
+
unlock: typeof unlockOperation<TOperationGeneric>;
|
|
8123
8168
|
update: typeof updateOperation$1<TOperationGeneric, SelectFromCollectionSlug<TOperationGeneric>>;
|
|
8124
8169
|
updateByID: typeof updateByIDOperation<TOperationGeneric, SelectFromCollectionSlug<TOperationGeneric>>;
|
|
8125
8170
|
};
|
|
@@ -8128,93 +8173,169 @@ type AfterOperationArg<TOperationGeneric extends CollectionSlug> = {
|
|
|
8128
8173
|
collection: SanitizedCollectionConfig;
|
|
8129
8174
|
req: PayloadRequest;
|
|
8130
8175
|
} & ({
|
|
8131
|
-
args: Parameters<
|
|
8176
|
+
args: Parameters<OperationMap<TOperationGeneric>['count']>[0];
|
|
8177
|
+
operation: 'count';
|
|
8178
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['count']>>;
|
|
8179
|
+
} | {
|
|
8180
|
+
args: Parameters<OperationMap<TOperationGeneric>['countVersions']>[0];
|
|
8181
|
+
operation: 'countVersions';
|
|
8182
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['countVersions']>>;
|
|
8183
|
+
} | {
|
|
8184
|
+
args: Parameters<OperationMap<TOperationGeneric>['create']>[0];
|
|
8185
|
+
operation: 'create';
|
|
8186
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['create']>>;
|
|
8187
|
+
} | {
|
|
8188
|
+
args: Parameters<OperationMap<TOperationGeneric>['delete']>[0];
|
|
8189
|
+
operation: 'delete';
|
|
8190
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['delete']>>;
|
|
8191
|
+
} | {
|
|
8192
|
+
args: Parameters<OperationMap<TOperationGeneric>['deleteByID']>[0];
|
|
8193
|
+
operation: 'deleteByID';
|
|
8194
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['deleteByID']>>;
|
|
8195
|
+
} | {
|
|
8196
|
+
args: Parameters<OperationMap<TOperationGeneric>['find']>[0];
|
|
8197
|
+
/**
|
|
8198
|
+
* @deprecated Use 'find' or 'findByID' operation instead
|
|
8199
|
+
*/
|
|
8200
|
+
operation: 'read';
|
|
8201
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['find']>>;
|
|
8202
|
+
} | {
|
|
8203
|
+
args: Parameters<OperationMap<TOperationGeneric>['find']>[0];
|
|
8204
|
+
operation: 'find';
|
|
8205
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['find']>>;
|
|
8206
|
+
} | {
|
|
8207
|
+
args: Parameters<OperationMap<TOperationGeneric>['findByID']>[0];
|
|
8208
|
+
operation: 'findByID';
|
|
8209
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['findByID']>>;
|
|
8210
|
+
} | {
|
|
8211
|
+
args: Parameters<OperationMap<TOperationGeneric>['findDistinct']>[0];
|
|
8212
|
+
operation: 'findDistinct';
|
|
8213
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['findDistinct']>>;
|
|
8214
|
+
} | {
|
|
8215
|
+
args: Parameters<OperationMap<TOperationGeneric>['findVersionByID']>[0];
|
|
8216
|
+
operation: 'findVersionByID';
|
|
8217
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['findVersionByID']>>;
|
|
8218
|
+
} | {
|
|
8219
|
+
args: Parameters<OperationMap<TOperationGeneric>['findVersions']>[0];
|
|
8220
|
+
operation: 'findVersions';
|
|
8221
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['findVersions']>>;
|
|
8222
|
+
} | {
|
|
8223
|
+
args: Parameters<OperationMap<TOperationGeneric>['forgotPassword']>[0];
|
|
8224
|
+
operation: 'forgotPassword';
|
|
8225
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['forgotPassword']>>;
|
|
8226
|
+
} | {
|
|
8227
|
+
args: Parameters<OperationMap<TOperationGeneric>['login']>[0];
|
|
8228
|
+
operation: 'login';
|
|
8229
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['login']>>;
|
|
8230
|
+
} | {
|
|
8231
|
+
args: Parameters<OperationMap<TOperationGeneric>['refresh']>[0];
|
|
8232
|
+
operation: 'refresh';
|
|
8233
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['refresh']>>;
|
|
8234
|
+
} | {
|
|
8235
|
+
args: Parameters<OperationMap<TOperationGeneric>['resetPassword']>[0];
|
|
8236
|
+
operation: 'resetPassword';
|
|
8237
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['resetPassword']>>;
|
|
8238
|
+
} | {
|
|
8239
|
+
args: Parameters<OperationMap<TOperationGeneric>['restoreVersion']>[0];
|
|
8240
|
+
operation: 'restoreVersion';
|
|
8241
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['restoreVersion']>>;
|
|
8242
|
+
} | {
|
|
8243
|
+
args: Parameters<OperationMap<TOperationGeneric>['unlock']>[0];
|
|
8244
|
+
operation: 'unlock';
|
|
8245
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['unlock']>>;
|
|
8246
|
+
} | {
|
|
8247
|
+
args: Parameters<OperationMap<TOperationGeneric>['update']>[0];
|
|
8248
|
+
operation: 'update';
|
|
8249
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['update']>>;
|
|
8250
|
+
} | {
|
|
8251
|
+
args: Parameters<OperationMap<TOperationGeneric>['updateByID']>[0];
|
|
8252
|
+
operation: 'updateByID';
|
|
8253
|
+
result: Awaited<ReturnType<OperationMap<TOperationGeneric>['updateByID']>>;
|
|
8254
|
+
});
|
|
8255
|
+
type BeforeOperationArg<TOperationGeneric extends CollectionSlug> = {
|
|
8256
|
+
/** The collection which this hook is being run on */
|
|
8257
|
+
collection: SanitizedCollectionConfig;
|
|
8258
|
+
context: RequestContext;
|
|
8259
|
+
req: PayloadRequest;
|
|
8260
|
+
} & ({
|
|
8261
|
+
args: Parameters<OperationMap<TOperationGeneric>['find']>[0] | Parameters<OperationMap<TOperationGeneric>['findByID']>[0];
|
|
8262
|
+
/**
|
|
8263
|
+
* @deprecated Use 'find' or 'findByID' operation instead
|
|
8264
|
+
*/
|
|
8265
|
+
operation: 'read';
|
|
8266
|
+
} | {
|
|
8267
|
+
args: Parameters<OperationMap<TOperationGeneric>['count']>[0];
|
|
8132
8268
|
operation: 'count';
|
|
8133
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['count']>>;
|
|
8134
8269
|
} | {
|
|
8135
|
-
args: Parameters<
|
|
8270
|
+
args: Parameters<OperationMap<TOperationGeneric>['countVersions']>[0];
|
|
8136
8271
|
operation: 'countVersions';
|
|
8137
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['countVersions']>>;
|
|
8138
8272
|
} | {
|
|
8139
|
-
args: Parameters<
|
|
8273
|
+
args: Parameters<OperationMap<TOperationGeneric>['create']>[0];
|
|
8140
8274
|
operation: 'create';
|
|
8141
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['create']>>;
|
|
8142
8275
|
} | {
|
|
8143
|
-
args: Parameters<
|
|
8276
|
+
args: Parameters<OperationMap<TOperationGeneric>['delete']>[0];
|
|
8144
8277
|
operation: 'delete';
|
|
8145
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['delete']>>;
|
|
8146
8278
|
} | {
|
|
8147
|
-
args: Parameters<
|
|
8279
|
+
args: Parameters<OperationMap<TOperationGeneric>['deleteByID']>[0];
|
|
8148
8280
|
operation: 'deleteByID';
|
|
8149
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['deleteByID']>>;
|
|
8150
8281
|
} | {
|
|
8151
|
-
args: Parameters<
|
|
8282
|
+
args: Parameters<OperationMap<TOperationGeneric>['find']>[0];
|
|
8152
8283
|
operation: 'find';
|
|
8153
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['find']>>;
|
|
8154
8284
|
} | {
|
|
8155
|
-
args: Parameters<
|
|
8285
|
+
args: Parameters<OperationMap<TOperationGeneric>['findByID']>[0];
|
|
8156
8286
|
operation: 'findByID';
|
|
8157
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['findByID']>>;
|
|
8158
8287
|
} | {
|
|
8159
|
-
args: Parameters<
|
|
8288
|
+
args: Parameters<OperationMap<TOperationGeneric>['findDistinct']>[0];
|
|
8160
8289
|
operation: 'findDistinct';
|
|
8161
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['findDistinct']>>;
|
|
8162
8290
|
} | {
|
|
8163
|
-
args: Parameters<
|
|
8291
|
+
args: Parameters<OperationMap<TOperationGeneric>['findDistinct']>[0];
|
|
8292
|
+
operation: 'readDistinct';
|
|
8293
|
+
} | {
|
|
8294
|
+
args: Parameters<OperationMap<TOperationGeneric>['findVersionByID']>[0];
|
|
8295
|
+
operation: 'findVersionByID';
|
|
8296
|
+
} | {
|
|
8297
|
+
args: Parameters<OperationMap<TOperationGeneric>['findVersions']>[0];
|
|
8298
|
+
operation: 'findVersions';
|
|
8299
|
+
} | {
|
|
8300
|
+
args: Parameters<OperationMap<TOperationGeneric>['forgotPassword']>[0];
|
|
8164
8301
|
operation: 'forgotPassword';
|
|
8165
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['forgotPassword']>>;
|
|
8166
8302
|
} | {
|
|
8167
|
-
args: Parameters<
|
|
8303
|
+
args: Parameters<OperationMap<TOperationGeneric>['login']>[0];
|
|
8168
8304
|
operation: 'login';
|
|
8169
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['login']>>;
|
|
8170
8305
|
} | {
|
|
8171
|
-
args: Parameters<
|
|
8306
|
+
args: Parameters<OperationMap<TOperationGeneric>['refresh']>[0];
|
|
8172
8307
|
operation: 'refresh';
|
|
8173
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['refresh']>>;
|
|
8174
8308
|
} | {
|
|
8175
|
-
args: Parameters<
|
|
8309
|
+
args: Parameters<OperationMap<TOperationGeneric>['resetPassword']>[0];
|
|
8176
8310
|
operation: 'resetPassword';
|
|
8177
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['resetPassword']>>;
|
|
8178
8311
|
} | {
|
|
8179
|
-
args: Parameters<
|
|
8312
|
+
args: Parameters<OperationMap<TOperationGeneric>['restoreVersion']>[0];
|
|
8180
8313
|
operation: 'restoreVersion';
|
|
8181
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['restoreVersion']>>;
|
|
8182
8314
|
} | {
|
|
8183
|
-
args: Parameters<
|
|
8315
|
+
args: Parameters<OperationMap<TOperationGeneric>['unlock']>[0];
|
|
8316
|
+
operation: 'unlock';
|
|
8317
|
+
} | {
|
|
8318
|
+
args: Parameters<OperationMap<TOperationGeneric>['update']>[0];
|
|
8184
8319
|
operation: 'update';
|
|
8185
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['update']>>;
|
|
8186
8320
|
} | {
|
|
8187
|
-
args: Parameters<
|
|
8321
|
+
args: Parameters<OperationMap<TOperationGeneric>['updateByID']>[0];
|
|
8188
8322
|
operation: 'updateByID';
|
|
8189
|
-
result: Awaited<ReturnType<AfterOperationMap<TOperationGeneric>['updateByID']>>;
|
|
8190
8323
|
});
|
|
8191
8324
|
|
|
8192
8325
|
type DataFromCollectionSlug<TSlug extends CollectionSlug> = TypedCollection[TSlug];
|
|
8193
8326
|
type SelectFromCollectionSlug<TSlug extends CollectionSlug> = TypedCollectionSelect[TSlug];
|
|
8194
8327
|
type AuthOperationsFromCollectionSlug<TSlug extends CollectionSlug> = TypedAuthOperations[TSlug];
|
|
8195
|
-
type RequiredDataFromCollection<TData extends JsonObject> = MarkOptional<TData, 'createdAt' | 'deletedAt' | 'id' | '
|
|
8328
|
+
type RequiredDataFromCollection<TData extends JsonObject> = MarkOptional<TData, 'createdAt' | 'deletedAt' | 'id' | 'updatedAt'>;
|
|
8196
8329
|
type RequiredDataFromCollectionSlug<TSlug extends CollectionSlug> = RequiredDataFromCollection<DataFromCollectionSlug<TSlug>>;
|
|
8197
8330
|
/**
|
|
8198
8331
|
* Helper type for draft data - makes all fields optional except auto-generated ones
|
|
8199
8332
|
* When creating a draft, required fields don't need to be provided as validation is skipped
|
|
8200
8333
|
*/
|
|
8201
|
-
type DraftDataFromCollection<TData extends JsonObject> = Partial<MarkOptional<TData, 'createdAt' | 'deletedAt' | 'id' | '
|
|
8334
|
+
type DraftDataFromCollection<TData extends JsonObject> = Partial<MarkOptional<TData, 'createdAt' | 'deletedAt' | 'id' | 'updatedAt'>>;
|
|
8202
8335
|
type DraftDataFromCollectionSlug<TSlug extends CollectionSlug> = DraftDataFromCollection<DataFromCollectionSlug<TSlug>>;
|
|
8203
8336
|
type HookOperationType = 'autosave' | 'count' | 'countVersions' | 'create' | 'delete' | 'forgotPassword' | 'login' | 'read' | 'readDistinct' | 'refresh' | 'resetPassword' | 'restoreVersion' | 'update';
|
|
8204
8337
|
type CreateOrUpdateOperation = Extract<HookOperationType, 'create' | 'update'>;
|
|
8205
|
-
type BeforeOperationHook = (
|
|
8206
|
-
args?: any;
|
|
8207
|
-
/**
|
|
8208
|
-
* The collection which this hook is being run on
|
|
8209
|
-
*/
|
|
8210
|
-
collection: SanitizedCollectionConfig;
|
|
8211
|
-
context: RequestContext;
|
|
8212
|
-
/**
|
|
8213
|
-
* Hook operation being performed
|
|
8214
|
-
*/
|
|
8215
|
-
operation: HookOperationType;
|
|
8216
|
-
req: PayloadRequest;
|
|
8217
|
-
}) => any;
|
|
8338
|
+
type BeforeOperationHook<TOperationGeneric extends CollectionSlug = string> = (arg: BeforeOperationArg<TOperationGeneric>) => Parameters<OperationMap<TOperationGeneric>[keyof OperationMap<TOperationGeneric>]>[0] | Promise<Parameters<OperationMap<TOperationGeneric>[keyof OperationMap<TOperationGeneric>]>[0]> | Promise<void> | void;
|
|
8218
8339
|
type BeforeValidateHook<T extends TypeWithID = any> = (args: {
|
|
8219
8340
|
/** The collection which this hook is being run on */
|
|
8220
8341
|
collection: SanitizedCollectionConfig;
|
|
@@ -8298,7 +8419,7 @@ type AfterDeleteHook<T extends TypeWithID = any> = (args: {
|
|
|
8298
8419
|
id: number | string;
|
|
8299
8420
|
req: PayloadRequest;
|
|
8300
8421
|
}) => any;
|
|
8301
|
-
type AfterOperationHook<TOperationGeneric extends CollectionSlug = string> = (arg: AfterOperationArg<TOperationGeneric>) => Awaited<ReturnType<
|
|
8422
|
+
type AfterOperationHook<TOperationGeneric extends CollectionSlug = string> = (arg: AfterOperationArg<TOperationGeneric>) => Awaited<ReturnType<OperationMap<TOperationGeneric>[keyof OperationMap<TOperationGeneric>]>> | Promise<Awaited<ReturnType<OperationMap<TOperationGeneric>[keyof OperationMap<TOperationGeneric>]>>>;
|
|
8302
8423
|
type BeforeLoginHook<T extends TypeWithID = any> = (args: {
|
|
8303
8424
|
/** The collection which this hook is being run on */
|
|
8304
8425
|
collection: SanitizedCollectionConfig;
|
|
@@ -8644,7 +8765,7 @@ type CollectionConfig<TSlug extends CollectionSlug = any> = {
|
|
|
8644
8765
|
beforeChange?: BeforeChangeHook[];
|
|
8645
8766
|
beforeDelete?: BeforeDeleteHook[];
|
|
8646
8767
|
beforeLogin?: BeforeLoginHook[];
|
|
8647
|
-
beforeOperation?: BeforeOperationHook[];
|
|
8768
|
+
beforeOperation?: BeforeOperationHook<TSlug>[];
|
|
8648
8769
|
beforeRead?: BeforeReadHook[];
|
|
8649
8770
|
beforeValidate?: BeforeValidateHook[];
|
|
8650
8771
|
/**
|
|
@@ -8786,7 +8907,7 @@ interface SanitizedCollectionConfig extends Omit<DeepRequired<CollectionConfig>,
|
|
|
8786
8907
|
sanitizedIndexes: SanitizedCompoundIndex[];
|
|
8787
8908
|
slug: CollectionSlug;
|
|
8788
8909
|
upload: SanitizedUploadConfig;
|
|
8789
|
-
versions
|
|
8910
|
+
versions?: SanitizedCollectionVersions;
|
|
8790
8911
|
}
|
|
8791
8912
|
type Collection = {
|
|
8792
8913
|
config: SanitizedCollectionConfig;
|
|
@@ -11058,24 +11179,24 @@ declare const jwtSign: ({ fieldsToSign, secret, tokenExpiration, }: {
|
|
|
11058
11179
|
token: string;
|
|
11059
11180
|
}>;
|
|
11060
11181
|
|
|
11061
|
-
type Arguments$
|
|
11182
|
+
type Arguments$9 = {
|
|
11062
11183
|
req: PayloadRequest;
|
|
11063
11184
|
};
|
|
11064
|
-
declare const accessOperation: (args: Arguments$
|
|
11185
|
+
declare const accessOperation: (args: Arguments$9) => Promise<SanitizedPermissions>;
|
|
11065
11186
|
|
|
11066
11187
|
declare const initOperation: (args: {
|
|
11067
11188
|
collection: string;
|
|
11068
11189
|
req: PayloadRequest;
|
|
11069
11190
|
}) => Promise<boolean>;
|
|
11070
11191
|
|
|
11071
|
-
type Arguments$
|
|
11192
|
+
type Arguments$8 = {
|
|
11072
11193
|
allSessions?: boolean;
|
|
11073
11194
|
collection: Collection;
|
|
11074
11195
|
req: PayloadRequest;
|
|
11075
11196
|
};
|
|
11076
|
-
declare const logoutOperation: (incomingArgs: Arguments$
|
|
11197
|
+
declare const logoutOperation: (incomingArgs: Arguments$8) => Promise<boolean>;
|
|
11077
11198
|
|
|
11078
|
-
type Arguments$
|
|
11199
|
+
type Arguments$7<TSlug extends CollectionSlug> = {
|
|
11079
11200
|
collection: Collection;
|
|
11080
11201
|
data: AuthOperationsFromCollectionSlug<TSlug>['registerFirstUser'] & RequiredDataFromCollectionSlug<TSlug>;
|
|
11081
11202
|
req: PayloadRequest;
|
|
@@ -11085,15 +11206,7 @@ type Result<TData> = {
|
|
|
11085
11206
|
token?: string;
|
|
11086
11207
|
user?: TData;
|
|
11087
11208
|
};
|
|
11088
|
-
declare const registerFirstUserOperation: <TSlug extends CollectionSlug>(args: Arguments$
|
|
11089
|
-
|
|
11090
|
-
type Arguments$9<TSlug extends CollectionSlug> = {
|
|
11091
|
-
collection: Collection;
|
|
11092
|
-
data: AuthOperationsFromCollectionSlug<TSlug>['unlock'];
|
|
11093
|
-
overrideAccess?: boolean;
|
|
11094
|
-
req: PayloadRequest;
|
|
11095
|
-
};
|
|
11096
|
-
declare const unlockOperation: <TSlug extends CollectionSlug>(args: Arguments$9<TSlug>) => Promise<boolean>;
|
|
11209
|
+
declare const registerFirstUserOperation: <TSlug extends CollectionSlug>(args: Arguments$7<TSlug>) => Promise<Result<DataFromCollectionSlug<TSlug>>>;
|
|
11097
11210
|
|
|
11098
11211
|
type Args$l = {
|
|
11099
11212
|
collection: Collection;
|
|
@@ -11157,7 +11270,7 @@ type CreateCacheKeyArgs = {
|
|
|
11157
11270
|
};
|
|
11158
11271
|
declare const createDataloaderCacheKey: ({ collectionSlug, currentDepth, depth, docID, draft, fallbackLocale, locale, overrideAccess, populate, select, showHiddenFields, transactionID, }: CreateCacheKeyArgs) => string;
|
|
11159
11272
|
|
|
11160
|
-
type Arguments$
|
|
11273
|
+
type Arguments$6 = {
|
|
11161
11274
|
collection: Collection;
|
|
11162
11275
|
/**
|
|
11163
11276
|
* If the document data is passed, it will be used to check access instead of fetching the document from the database.
|
|
@@ -11169,45 +11282,13 @@ type Arguments$8 = {
|
|
|
11169
11282
|
id?: number | string;
|
|
11170
11283
|
req: PayloadRequest;
|
|
11171
11284
|
};
|
|
11172
|
-
declare function docAccessOperation$1(args: Arguments$
|
|
11285
|
+
declare function docAccessOperation$1(args: Arguments$6): Promise<SanitizedCollectionPermission>;
|
|
11173
11286
|
|
|
11174
|
-
type Arguments$
|
|
11287
|
+
type Arguments$5<TSlug extends CollectionSlug> = {
|
|
11175
11288
|
data?: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>;
|
|
11176
11289
|
id: number | string;
|
|
11177
|
-
} & Omit<Arguments$
|
|
11178
|
-
declare const duplicateOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: Arguments$
|
|
11179
|
-
|
|
11180
|
-
type Arguments$6 = {
|
|
11181
|
-
collection: Collection;
|
|
11182
|
-
currentDepth?: number;
|
|
11183
|
-
depth?: number;
|
|
11184
|
-
disableErrors?: boolean;
|
|
11185
|
-
id: number | string;
|
|
11186
|
-
overrideAccess?: boolean;
|
|
11187
|
-
populate?: PopulateType;
|
|
11188
|
-
req: PayloadRequest;
|
|
11189
|
-
select?: SelectType;
|
|
11190
|
-
showHiddenFields?: boolean;
|
|
11191
|
-
trash?: boolean;
|
|
11192
|
-
};
|
|
11193
|
-
declare const findVersionByIDOperation$1: <TData extends TypeWithID = any>(args: Arguments$6) => Promise<TypeWithVersion<TData>>;
|
|
11194
|
-
|
|
11195
|
-
type Arguments$5 = {
|
|
11196
|
-
collection: Collection;
|
|
11197
|
-
depth?: number;
|
|
11198
|
-
limit?: number;
|
|
11199
|
-
overrideAccess?: boolean;
|
|
11200
|
-
page?: number;
|
|
11201
|
-
pagination?: boolean;
|
|
11202
|
-
populate?: PopulateType;
|
|
11203
|
-
req?: PayloadRequest;
|
|
11204
|
-
select?: SelectType;
|
|
11205
|
-
showHiddenFields?: boolean;
|
|
11206
|
-
sort?: Sort;
|
|
11207
|
-
trash?: boolean;
|
|
11208
|
-
where?: Where;
|
|
11209
|
-
};
|
|
11210
|
-
declare const findVersionsOperation$1: <TData extends TypeWithVersion<TData>>(args: Arguments$5) => Promise<PaginatedDocs<TData>>;
|
|
11290
|
+
} & Omit<Arguments$i<TSlug>, 'data' | 'duplicateFromID'>;
|
|
11291
|
+
declare const duplicateOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: Arguments$5<TSlug>) => Promise<TransformCollectionWithSelect<TSlug, TSelect>>;
|
|
11211
11292
|
|
|
11212
11293
|
type Arguments$4 = {
|
|
11213
11294
|
collection: Collection;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CollectionConfig } from '../collections/config/types.js';
|
|
2
|
+
import type { GlobalConfig } from '../globals/config/types.js';
|
|
3
|
+
import type { Autosave, SanitizedDrafts } from '../versions/types.js';
|
|
4
|
+
type EntityConfig = Pick<CollectionConfig | GlobalConfig, 'versions'>;
|
|
5
|
+
/**
|
|
6
|
+
* Check if an entity has drafts enabled
|
|
7
|
+
*/
|
|
8
|
+
export declare const hasDraftsEnabled: (config: EntityConfig) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Check if an entity has autosave enabled
|
|
11
|
+
*/
|
|
12
|
+
export declare const hasAutosaveEnabled: (config: EntityConfig) => config is {
|
|
13
|
+
versions: {
|
|
14
|
+
drafts: {
|
|
15
|
+
autosave: Autosave | false;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
} & EntityConfig;
|
|
19
|
+
/**
|
|
20
|
+
* Check if an entity has validate drafts enabled
|
|
21
|
+
*/
|
|
22
|
+
export declare const hasDraftValidationEnabled: (config: EntityConfig) => boolean;
|
|
23
|
+
export declare const hasScheduledPublishEnabled: (config: EntityConfig) => config is {
|
|
24
|
+
versions: {
|
|
25
|
+
drafts: {
|
|
26
|
+
schedulePublish: SanitizedDrafts["schedulePublish"];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
} & EntityConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Get the maximum number of versions to keep for an entity
|
|
32
|
+
* Returns maxPerDoc for collections or max for globals
|
|
33
|
+
*/
|
|
34
|
+
export declare const getVersionsMax: (config: EntityConfig) => number;
|
|
35
|
+
export declare const getAutosaveInterval: (config: EntityConfig) => number;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=getVersionsConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getVersionsConfig.d.ts","sourceRoot":"","sources":["../../src/utilities/getVersionsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAIrE,KAAK,YAAY,GAAG,IAAI,CAAC,gBAAgB,GAAG,YAAY,EAAE,UAAU,CAAC,CAAA;AAErE;;GAEG;AACH,eAAO,MAAM,gBAAgB,WAAY,YAAY,KAAG,OAEvD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,WACrB,YAAY,KACnB,MAAM,IAAI;IACX,QAAQ,EAAE;QACR,MAAM,EAAE;YAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAAA;SAAE,CAAA;KACvC,CAAA;CACF,GAAG,YAQH,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,WAAY,YAAY,KAAG,OAQhE,CAAA;AAED,eAAO,MAAM,0BAA0B,WAC7B,YAAY,KACnB,MAAM,IAAI;IACX,QAAQ,EAAE;QACR,MAAM,EAAE;YAAE,eAAe,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAA;SAAE,CAAA;KAChE,CAAA;CACF,GAAG,YAQH,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,WAAY,YAAY,KAAG,MAYrD,CAAA;AAED,eAAO,MAAM,mBAAmB,WAAY,YAAY,KAAG,MAa1D,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { versionDefaults } from '../versions/defaults.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check if an entity has drafts enabled
|
|
4
|
+
*/ export const hasDraftsEnabled = (config)=>{
|
|
5
|
+
return Boolean(config?.versions && typeof config.versions === 'object' && config.versions.drafts);
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Check if an entity has autosave enabled
|
|
9
|
+
*/ export const hasAutosaveEnabled = (config)=>{
|
|
10
|
+
return Boolean(config?.versions && typeof config.versions === 'object' && config.versions.drafts && typeof config.versions.drafts === 'object' && config.versions.drafts.autosave);
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Check if an entity has validate drafts enabled
|
|
14
|
+
*/ export const hasDraftValidationEnabled = (config)=>{
|
|
15
|
+
return Boolean(config?.versions && typeof config.versions === 'object' && config.versions.drafts && typeof config.versions.drafts === 'object' && config.versions.drafts.validate);
|
|
16
|
+
};
|
|
17
|
+
export const hasScheduledPublishEnabled = (config)=>{
|
|
18
|
+
return Boolean(config?.versions && typeof config.versions === 'object' && config.versions.drafts && typeof config.versions.drafts === 'object' && config.versions.drafts.schedulePublish);
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Get the maximum number of versions to keep for an entity
|
|
22
|
+
* Returns maxPerDoc for collections or max for globals
|
|
23
|
+
*/ export const getVersionsMax = (config)=>{
|
|
24
|
+
if (!config?.versions || typeof config.versions !== 'object') {
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
// Collections have maxPerDoc, globals have max
|
|
28
|
+
if ('maxPerDoc' in config.versions) {
|
|
29
|
+
return config.versions.maxPerDoc ?? 0;
|
|
30
|
+
}
|
|
31
|
+
if ('max' in config.versions) {
|
|
32
|
+
return config.versions.max ?? 0;
|
|
33
|
+
}
|
|
34
|
+
return 0;
|
|
35
|
+
};
|
|
36
|
+
export const getAutosaveInterval = (config)=>{
|
|
37
|
+
let interval = versionDefaults.autosaveInterval;
|
|
38
|
+
if (config?.versions && typeof config.versions === 'object' && config.versions.drafts && typeof config.versions.drafts === 'object' && config.versions.drafts.autosave && typeof config.versions.drafts.autosave === 'object') {
|
|
39
|
+
interval = config.versions.drafts.autosave.interval ?? versionDefaults.autosaveInterval;
|
|
40
|
+
}
|
|
41
|
+
return interval;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=getVersionsConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/getVersionsConfig.ts"],"sourcesContent":["import type { CollectionConfig } from '../collections/config/types.js'\nimport type { GlobalConfig } from '../globals/config/types.js'\nimport type { Autosave, SanitizedDrafts } from '../versions/types.js'\n\nimport { versionDefaults } from '../versions/defaults.js'\n\ntype EntityConfig = Pick<CollectionConfig | GlobalConfig, 'versions'>\n\n/**\n * Check if an entity has drafts enabled\n */\nexport const hasDraftsEnabled = (config: EntityConfig): boolean => {\n return Boolean(config?.versions && typeof config.versions === 'object' && config.versions.drafts)\n}\n\n/**\n * Check if an entity has autosave enabled\n */\nexport const hasAutosaveEnabled = (\n config: EntityConfig,\n): config is {\n versions: {\n drafts: { autosave: Autosave | false }\n }\n} & EntityConfig => {\n return Boolean(\n config?.versions &&\n typeof config.versions === 'object' &&\n config.versions.drafts &&\n typeof config.versions.drafts === 'object' &&\n config.versions.drafts.autosave,\n )\n}\n\n/**\n * Check if an entity has validate drafts enabled\n */\nexport const hasDraftValidationEnabled = (config: EntityConfig): boolean => {\n return Boolean(\n config?.versions &&\n typeof config.versions === 'object' &&\n config.versions.drafts &&\n typeof config.versions.drafts === 'object' &&\n config.versions.drafts.validate,\n )\n}\n\nexport const hasScheduledPublishEnabled = (\n config: EntityConfig,\n): config is {\n versions: {\n drafts: { schedulePublish: SanitizedDrafts['schedulePublish'] }\n }\n} & EntityConfig => {\n return Boolean(\n config?.versions &&\n typeof config.versions === 'object' &&\n config.versions.drafts &&\n typeof config.versions.drafts === 'object' &&\n config.versions.drafts.schedulePublish,\n )\n}\n\n/**\n * Get the maximum number of versions to keep for an entity\n * Returns maxPerDoc for collections or max for globals\n */\nexport const getVersionsMax = (config: EntityConfig): number => {\n if (!config?.versions || typeof config.versions !== 'object') {\n return 0\n }\n // Collections have maxPerDoc, globals have max\n if ('maxPerDoc' in config.versions) {\n return config.versions.maxPerDoc ?? 0\n }\n if ('max' in config.versions) {\n return config.versions.max ?? 0\n }\n return 0\n}\n\nexport const getAutosaveInterval = (config: EntityConfig): number => {\n let interval = versionDefaults.autosaveInterval\n if (\n config?.versions &&\n typeof config.versions === 'object' &&\n config.versions.drafts &&\n typeof config.versions.drafts === 'object' &&\n config.versions.drafts.autosave &&\n typeof config.versions.drafts.autosave === 'object'\n ) {\n interval = config.versions.drafts.autosave.interval ?? versionDefaults.autosaveInterval\n }\n return interval\n}\n"],"names":["versionDefaults","hasDraftsEnabled","config","Boolean","versions","drafts","hasAutosaveEnabled","autosave","hasDraftValidationEnabled","validate","hasScheduledPublishEnabled","schedulePublish","getVersionsMax","maxPerDoc","max","getAutosaveInterval","interval","autosaveInterval"],"mappings":"AAIA,SAASA,eAAe,QAAQ,0BAAyB;AAIzD;;CAEC,GACD,OAAO,MAAMC,mBAAmB,CAACC;IAC/B,OAAOC,QAAQD,QAAQE,YAAY,OAAOF,OAAOE,QAAQ,KAAK,YAAYF,OAAOE,QAAQ,CAACC,MAAM;AAClG,EAAC;AAED;;CAEC,GACD,OAAO,MAAMC,qBAAqB,CAChCJ;IAMA,OAAOC,QACLD,QAAQE,YACN,OAAOF,OAAOE,QAAQ,KAAK,YAC3BF,OAAOE,QAAQ,CAACC,MAAM,IACtB,OAAOH,OAAOE,QAAQ,CAACC,MAAM,KAAK,YAClCH,OAAOE,QAAQ,CAACC,MAAM,CAACE,QAAQ;AAErC,EAAC;AAED;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACN;IACxC,OAAOC,QACLD,QAAQE,YACN,OAAOF,OAAOE,QAAQ,KAAK,YAC3BF,OAAOE,QAAQ,CAACC,MAAM,IACtB,OAAOH,OAAOE,QAAQ,CAACC,MAAM,KAAK,YAClCH,OAAOE,QAAQ,CAACC,MAAM,CAACI,QAAQ;AAErC,EAAC;AAED,OAAO,MAAMC,6BAA6B,CACxCR;IAMA,OAAOC,QACLD,QAAQE,YACN,OAAOF,OAAOE,QAAQ,KAAK,YAC3BF,OAAOE,QAAQ,CAACC,MAAM,IACtB,OAAOH,OAAOE,QAAQ,CAACC,MAAM,KAAK,YAClCH,OAAOE,QAAQ,CAACC,MAAM,CAACM,eAAe;AAE5C,EAAC;AAED;;;CAGC,GACD,OAAO,MAAMC,iBAAiB,CAACV;IAC7B,IAAI,CAACA,QAAQE,YAAY,OAAOF,OAAOE,QAAQ,KAAK,UAAU;QAC5D,OAAO;IACT;IACA,+CAA+C;IAC/C,IAAI,eAAeF,OAAOE,QAAQ,EAAE;QAClC,OAAOF,OAAOE,QAAQ,CAACS,SAAS,IAAI;IACtC;IACA,IAAI,SAASX,OAAOE,QAAQ,EAAE;QAC5B,OAAOF,OAAOE,QAAQ,CAACU,GAAG,IAAI;IAChC;IACA,OAAO;AACT,EAAC;AAED,OAAO,MAAMC,sBAAsB,CAACb;IAClC,IAAIc,WAAWhB,gBAAgBiB,gBAAgB;IAC/C,IACEf,QAAQE,YACR,OAAOF,OAAOE,QAAQ,KAAK,YAC3BF,OAAOE,QAAQ,CAACC,MAAM,IACtB,OAAOH,OAAOE,QAAQ,CAACC,MAAM,KAAK,YAClCH,OAAOE,QAAQ,CAACC,MAAM,CAACE,QAAQ,IAC/B,OAAOL,OAAOE,QAAQ,CAACC,MAAM,CAACE,QAAQ,KAAK,UAC3C;QACAS,WAAWd,OAAOE,QAAQ,CAACC,MAAM,CAACE,QAAQ,CAACS,QAAQ,IAAIhB,gBAAgBiB,gBAAgB;IACzF;IACA,OAAOD;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildCollectionFields.d.ts","sourceRoot":"","sources":["../../src/versions/buildCollectionFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"buildCollectionFields.d.ts","sourceRoot":"","sources":["../../src/versions/buildCollectionFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAKtE,eAAO,MAAM,4BAA4B,GAAI,CAAC,SAAS,OAAO,kBACpD,eAAe,cACX,yBAAyB,YAC3B,CAAC,KACV,IAAI,SAAS,CAAC,GAAG,cAAc,EAAE,GAAG,KAAK,EA2E3C,CAAA"}
|