payload 3.0.0-beta.38 → 3.0.0-beta.39
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/auth.d.ts +6 -0
- package/auth.js +6 -0
- package/components.d.ts +14 -0
- package/components.js +71 -0
- package/config.d.ts +14 -0
- package/config.js +14 -0
- package/database.d.ts +23 -0
- package/database.js +22 -0
- package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
- package/dist/collections/operations/restoreVersion.js +1 -0
- package/dist/collections/operations/restoreVersion.js.map +1 -1
- package/dist/database/migrations/getPredefinedMigration.d.ts +12 -0
- package/dist/database/migrations/getPredefinedMigration.d.ts.map +1 -0
- package/dist/database/migrations/getPredefinedMigration.js +41 -0
- package/dist/database/migrations/getPredefinedMigration.js.map +1 -0
- package/dist/database/types.d.ts +5 -0
- package/dist/database/types.d.ts.map +1 -1
- package/dist/database/types.js.map +1 -1
- package/dist/exports/database.d.ts +2 -1
- package/dist/exports/database.d.ts.map +1 -1
- package/dist/exports/database.js +1 -0
- package/dist/exports/database.js.map +1 -1
- package/dist/versions/saveVersion.d.ts.map +1 -1
- package/dist/versions/saveVersion.js +1 -0
- package/dist/versions/saveVersion.js.map +1 -1
- package/errors.d.ts +2 -0
- package/errors.js +3 -0
- package/graphql.d.ts +3 -0
- package/graphql.js +27 -0
- package/operations.d.ts +30 -0
- package/operations.js +31 -0
- package/package.json +2 -2
- package/types.d.ts +17 -0
- package/types.js +5 -0
- package/utilities.d.ts +33 -0
- package/utilities.js +34 -0
- package/versions.d.ts +9 -0
- package/versions.js +9 -0
package/auth.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './dist/auth/index.js';
|
|
2
|
+
export { default as executeAccess } from './dist/auth/executeAccess.js';
|
|
3
|
+
export { getAccessResults } from './dist/auth/getAccessResults.js';
|
|
4
|
+
export { getAuthenticatedUser } from './dist/auth/getAuthenticatedUser.js';
|
|
5
|
+
export type { AuthStrategyFunction, AuthStrategyFunctionArgs, CollectionPermission, FieldPermissions, GlobalPermission, IncomingAuthType, Permission, Permissions, User, VerifyConfig, } from './dist/auth/types.js';
|
|
6
|
+
//# sourceMappingURL=auth.d.ts.map
|
package/auth.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './dist/auth/index.js';
|
|
2
|
+
export { default as executeAccess } from './dist/auth/executeAccess.js';
|
|
3
|
+
export { getAccessResults } from './dist/auth/getAccessResults.js';
|
|
4
|
+
export { getAuthenticatedUser } from './dist/auth/getAuthenticatedUser.js';
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=auth.js.map
|
package/components.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { default as Banner } from './dist/admin/components/elements/Banner';
|
|
2
|
+
export { default as Button } from './dist/admin/components/elements/Button';
|
|
3
|
+
export { ErrorPill } from './dist/admin/components/elements/ErrorPill';
|
|
4
|
+
export { default as Pill } from './dist/admin/components/elements/Pill';
|
|
5
|
+
export { default as Popup } from './dist/admin/components/elements/Popup';
|
|
6
|
+
export { ShimmerEffect } from './dist/admin/components/elements/ShimmerEffect';
|
|
7
|
+
export { default as Tooltip } from './dist/admin/components/elements/Tooltip';
|
|
8
|
+
export { default as Check } from './dist/admin/components/icons/Check';
|
|
9
|
+
export { default as Chevron } from './dist/admin/components/icons/Chevron';
|
|
10
|
+
export { default as Menu } from './dist/admin/components/icons/Menu';
|
|
11
|
+
export { default as Search } from './dist/admin/components/icons/Search';
|
|
12
|
+
export { default as X } from './dist/admin/components/icons/X';
|
|
13
|
+
export { default as MinimalTemplate } from './dist/admin/components/templates/Minimal';
|
|
14
|
+
//# sourceMappingURL=components.d.ts.map
|
package/components.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
Banner: function() {
|
|
13
|
+
return _Banner.default;
|
|
14
|
+
},
|
|
15
|
+
Button: function() {
|
|
16
|
+
return _Button.default;
|
|
17
|
+
},
|
|
18
|
+
Check: function() {
|
|
19
|
+
return _Check.default;
|
|
20
|
+
},
|
|
21
|
+
Chevron: function() {
|
|
22
|
+
return _Chevron.default;
|
|
23
|
+
},
|
|
24
|
+
ErrorPill: function() {
|
|
25
|
+
return _ErrorPill.ErrorPill;
|
|
26
|
+
},
|
|
27
|
+
Menu: function() {
|
|
28
|
+
return _Menu.default;
|
|
29
|
+
},
|
|
30
|
+
MinimalTemplate: function() {
|
|
31
|
+
return _Minimal.default;
|
|
32
|
+
},
|
|
33
|
+
Pill: function() {
|
|
34
|
+
return _Pill.default;
|
|
35
|
+
},
|
|
36
|
+
Popup: function() {
|
|
37
|
+
return _Popup.default;
|
|
38
|
+
},
|
|
39
|
+
Search: function() {
|
|
40
|
+
return _Search.default;
|
|
41
|
+
},
|
|
42
|
+
ShimmerEffect: function() {
|
|
43
|
+
return _ShimmerEffect.ShimmerEffect;
|
|
44
|
+
},
|
|
45
|
+
Tooltip: function() {
|
|
46
|
+
return _Tooltip.default;
|
|
47
|
+
},
|
|
48
|
+
X: function() {
|
|
49
|
+
return _X.default;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const _Banner = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Banner"));
|
|
53
|
+
const _Button = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Button"));
|
|
54
|
+
const _ErrorPill = require("./dist/admin/components/elements/ErrorPill");
|
|
55
|
+
const _Pill = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Pill"));
|
|
56
|
+
const _Popup = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Popup"));
|
|
57
|
+
const _ShimmerEffect = require("./dist/admin/components/elements/ShimmerEffect");
|
|
58
|
+
const _Tooltip = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/elements/Tooltip"));
|
|
59
|
+
const _Check = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/Check"));
|
|
60
|
+
const _Chevron = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/Chevron"));
|
|
61
|
+
const _Menu = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/Menu"));
|
|
62
|
+
const _Search = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/Search"));
|
|
63
|
+
const _X = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/icons/X"));
|
|
64
|
+
const _Minimal = /*#__PURE__*/ _interop_require_default(require("./dist/admin/components/templates/Minimal"));
|
|
65
|
+
function _interop_require_default(obj) {
|
|
66
|
+
return obj && obj.__esModule ? obj : {
|
|
67
|
+
default: obj
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRzL2NvbXBvbmVudHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZGVmYXVsdCBhcyBCYW5uZXIgfSBmcm9tICcuLi9hZG1pbi9jb21wb25lbnRzL2VsZW1lbnRzL0Jhbm5lcidcbmV4cG9ydCB7IGRlZmF1bHQgYXMgQnV0dG9uIH0gZnJvbSAnLi4vYWRtaW4vY29tcG9uZW50cy9lbGVtZW50cy9CdXR0b24nXG5cbmV4cG9ydCB7IEVycm9yUGlsbCB9IGZyb20gJy4uL2FkbWluL2NvbXBvbmVudHMvZWxlbWVudHMvRXJyb3JQaWxsJ1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBQaWxsIH0gZnJvbSAnLi4vYWRtaW4vY29tcG9uZW50cy9lbGVtZW50cy9QaWxsJ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joiOzs7Ozs7Ozs7OztJQUFvQkEsTUFBTTtlQUFOQSxlQUFNOztJQUNOQyxNQUFNO2VBQU5BLGVBQU07O0lBU05DLEtBQUs7ZUFBTEEsY0FBSzs7SUFDTEMsT0FBTztlQUFQQSxnQkFBTzs7SUFSbEJDLFNBQVM7ZUFBVEEsb0JBQVM7O0lBU0VDLElBQUk7ZUFBSkEsYUFBSTs7SUFHSkMsZUFBZTtlQUFmQSxnQkFBZTs7SUFYZkMsSUFBSTtlQUFKQSxhQUFJOztJQUVKQyxLQUFLO2VBQUxBLGNBQUs7O0lBT0xDLE1BQU07ZUFBTkEsZUFBTTs7SUFMakJDLGFBQWE7ZUFBYkEsNEJBQWE7O0lBQ0ZDLE9BQU87ZUFBUEEsZ0JBQU87O0lBS1BDLENBQUM7ZUFBREEsVUFBQzs7OytEQWRhOytEQUNBOzJCQUVSOzZEQUNNOzhEQUVDOytCQUVIO2dFQUNLOzhEQUNGO2dFQUNFOzZEQUNIOytEQUNFOzBEQUNMO2dFQUNjIn0=
|
package/config.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { buildConfig } from './dist/config/build.js';
|
|
2
|
+
export * from './dist/config/types.js';
|
|
3
|
+
export type { FieldTypes } from './dist/admin/forms/FieldTypes.js';
|
|
4
|
+
export { createClientCollectionConfig } from './dist/collections/config/client.js';
|
|
5
|
+
export { defaults as collectionDefaults } from './dist/collections/config/defaults.js';
|
|
6
|
+
export { createClientConfig } from './dist/config/client.js';
|
|
7
|
+
export { defaults } from './dist/config/defaults.js';
|
|
8
|
+
export { sanitizeConfig } from './dist/config/sanitize.js';
|
|
9
|
+
export { baseBlockFields } from './dist/fields/baseFields/baseBlockFields.js';
|
|
10
|
+
export { baseIDField } from './dist/fields/baseFields/baseIDField.js';
|
|
11
|
+
export { createClientFieldConfig } from './dist/fields/config/client.js';
|
|
12
|
+
export { sanitizeFields } from './dist/fields/config/sanitize.js';
|
|
13
|
+
export { createClientGlobalConfig } from './dist/globals/config/client.js';
|
|
14
|
+
//# sourceMappingURL=config.d.ts.map
|
package/config.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { buildConfig } from './dist/config/build.js';
|
|
2
|
+
export * from './dist/config/types.js';
|
|
3
|
+
export { createClientCollectionConfig } from './dist/collections/config/client.js';
|
|
4
|
+
export { defaults as collectionDefaults } from './dist/collections/config/defaults.js';
|
|
5
|
+
export { createClientConfig } from './dist/config/client.js';
|
|
6
|
+
export { defaults } from './dist/config/defaults.js';
|
|
7
|
+
export { sanitizeConfig } from './dist/config/sanitize.js';
|
|
8
|
+
export { baseBlockFields } from './dist/fields/baseFields/baseBlockFields.js';
|
|
9
|
+
export { baseIDField } from './dist/fields/baseFields/baseIDField.js';
|
|
10
|
+
export { createClientFieldConfig } from './dist/fields/config/client.js';
|
|
11
|
+
export { sanitizeFields } from './dist/fields/config/sanitize.js';
|
|
12
|
+
export { createClientGlobalConfig } from './dist/globals/config/client.js';
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=config.js.map
|
package/database.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type { BaseDatabaseAdapter, BeginTransaction, CommitTransaction, Connect, Create, CreateArgs, CreateGlobal, CreateGlobalArgs, CreateGlobalVersion, CreateGlobalVersionArgs, CreateMigration, CreateVersion, CreateVersionArgs, DBIdentifierName, DatabaseAdapterResult as DatabaseAdapterObj, DeleteMany, DeleteManyArgs, DeleteOne, DeleteOneArgs, DeleteVersions, DeleteVersionsArgs, Destroy, Find, FindArgs, FindGlobal, FindGlobalArgs, FindGlobalVersions, FindGlobalVersionsArgs, FindOne, FindOneArgs, FindVersions, FindVersionsArgs, Init, Migration, MigrationData, PaginatedDocs, QueryDrafts, QueryDraftsArgs, RollbackTransaction, Transaction, TypeWithVersion, UpdateGlobal, UpdateGlobalArgs, UpdateGlobalVersion, UpdateGlobalVersionArgs, UpdateOne, UpdateOneArgs, UpdateVersion, UpdateVersionArgs, } from './dist/database/types.js';
|
|
2
|
+
export * from './dist/database/queryValidation/types.js';
|
|
3
|
+
export { combineQueries } from './dist/database/combineQueries.js';
|
|
4
|
+
export { createDatabaseAdapter } from './dist/database/createDatabaseAdapter.js';
|
|
5
|
+
export { default as flattenWhereToOperators } from './dist/database/flattenWhereToOperators.js';
|
|
6
|
+
export { getLocalizedPaths } from './dist/database/getLocalizedPaths.js';
|
|
7
|
+
export { createMigration } from './dist/database/migrations/createMigration.js';
|
|
8
|
+
export { getMigrations } from './dist/database/migrations/getMigrations.js';
|
|
9
|
+
export { migrate } from './dist/database/migrations/migrate.js';
|
|
10
|
+
export { migrateDown } from './dist/database/migrations/migrateDown.js';
|
|
11
|
+
export { migrateRefresh } from './dist/database/migrations/migrateRefresh.js';
|
|
12
|
+
export { migrateReset } from './dist/database/migrations/migrateReset.js';
|
|
13
|
+
export { migrateStatus } from './dist/database/migrations/migrateStatus.js';
|
|
14
|
+
export { migrationTemplate } from './dist/database/migrations/migrationTemplate.js';
|
|
15
|
+
export { migrationsCollection } from './dist/database/migrations/migrationsCollection.js';
|
|
16
|
+
export { readMigrationFiles } from './dist/database/migrations/readMigrationFiles.js';
|
|
17
|
+
export type { EntityPolicies, PathToQuery } from './dist/database/queryValidation/types.js';
|
|
18
|
+
export { validateQueryPaths } from './dist/database/queryValidation/validateQueryPaths.js';
|
|
19
|
+
export { validateSearchParam } from './dist/database/queryValidation/validateSearchParams.js';
|
|
20
|
+
export { commitTransaction } from './dist/utilities/commitTransaction.js';
|
|
21
|
+
export { initTransaction } from './dist/utilities/initTransaction.js';
|
|
22
|
+
export { killTransaction } from './dist/utilities/killTransaction.js';
|
|
23
|
+
//# sourceMappingURL=database.d.ts.map
|
package/database.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * from './dist/database/queryValidation/types.js';
|
|
2
|
+
export { combineQueries } from './dist/database/combineQueries.js';
|
|
3
|
+
export { createDatabaseAdapter } from './dist/database/createDatabaseAdapter.js';
|
|
4
|
+
export { default as flattenWhereToOperators } from './dist/database/flattenWhereToOperators.js';
|
|
5
|
+
export { getLocalizedPaths } from './dist/database/getLocalizedPaths.js';
|
|
6
|
+
export { createMigration } from './dist/database/migrations/createMigration.js';
|
|
7
|
+
export { getMigrations } from './dist/database/migrations/getMigrations.js';
|
|
8
|
+
export { migrate } from './dist/database/migrations/migrate.js';
|
|
9
|
+
export { migrateDown } from './dist/database/migrations/migrateDown.js';
|
|
10
|
+
export { migrateRefresh } from './dist/database/migrations/migrateRefresh.js';
|
|
11
|
+
export { migrateReset } from './dist/database/migrations/migrateReset.js';
|
|
12
|
+
export { migrateStatus } from './dist/database/migrations/migrateStatus.js';
|
|
13
|
+
export { migrationTemplate } from './dist/database/migrations/migrationTemplate.js';
|
|
14
|
+
export { migrationsCollection } from './dist/database/migrations/migrationsCollection.js';
|
|
15
|
+
export { readMigrationFiles } from './dist/database/migrations/readMigrationFiles.js';
|
|
16
|
+
export { validateQueryPaths } from './dist/database/queryValidation/validateQueryPaths.js';
|
|
17
|
+
export { validateSearchParam } from './dist/database/queryValidation/validateSearchParams.js';
|
|
18
|
+
export { commitTransaction } from './dist/utilities/commitTransaction.js';
|
|
19
|
+
export { initTransaction } from './dist/utilities/initTransaction.js';
|
|
20
|
+
export { killTransaction } from './dist/utilities/killTransaction.js';
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=database.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/restoreVersion.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAahE,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,sBAAsB,CAAA;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,uBAAuB,qCAC5B,SAAS,KACd,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/restoreVersion.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAahE,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,sBAAsB,CAAA;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,uBAAuB,qCAC5B,SAAS,KACd,QAAQ,CAAC,CAmLX,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/collections/operations/restoreVersion.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport httpStatus from 'http-status'\n\nimport type { FindOneArgs } from '../../database/types.js'\nimport type { PayloadRequestWithData } from '../../types/index.js'\nimport type { Collection, TypeWithID } from '../config/types.js'\n\nimport executeAccess from '../../auth/executeAccess.js'\nimport { hasWhereAccessResult } from '../../auth/types.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { APIError, Forbidden, NotFound } from '../../errors/index.js'\nimport { afterChange } from '../../fields/hooks/afterChange/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { getLatestCollectionVersion } from '../../versions/getLatestCollectionVersion.js'\n\nexport type Arguments = {\n collection: Collection\n currentDepth?: number\n depth?: number\n disableErrors?: boolean\n id: number | string\n overrideAccess?: boolean\n req: PayloadRequestWithData\n showHiddenFields?: boolean\n}\n\nexport const restoreVersionOperation = async <T extends TypeWithID = any>(\n args: Arguments,\n): Promise<T> => {\n const {\n id,\n collection: { config: collectionConfig },\n depth,\n overrideAccess = false,\n req,\n req: { fallbackLocale, locale, payload },\n showHiddenFields,\n } = args\n\n try {\n const shouldCommit = await initTransaction(req)\n\n if (!id) {\n throw new APIError('Missing ID of version to restore.', httpStatus.BAD_REQUEST)\n }\n\n // /////////////////////////////////////\n // Retrieve original raw version\n // /////////////////////////////////////\n\n const { docs: versionDocs } = await req.payload.db.findVersions({\n collection: collectionConfig.slug,\n limit: 1,\n locale,\n req,\n where: { id: { equals: id } },\n })\n\n const [rawVersion] = versionDocs\n\n if (!rawVersion) {\n throw new NotFound(req.t)\n }\n\n const parentDocID = rawVersion.parent\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n const accessResults = !overrideAccess\n ? await executeAccess({ id: parentDocID, req }, collectionConfig.access.update)\n : true\n const hasWherePolicy = hasWhereAccessResult(accessResults)\n\n // /////////////////////////////////////\n // Retrieve document\n // /////////////////////////////////////\n\n const findOneArgs: FindOneArgs = {\n collection: collectionConfig.slug,\n locale,\n req,\n where: combineQueries({ id: { equals: parentDocID } }, accessResults),\n }\n\n const doc = await req.payload.db.findOne(findOneArgs)\n\n if (!doc && !hasWherePolicy) throw new NotFound(req.t)\n if (!doc && hasWherePolicy) throw new Forbidden(req.t)\n\n // /////////////////////////////////////\n // fetch previousDoc\n // /////////////////////////////////////\n\n const prevDocWithLocales = await getLatestCollectionVersion({\n id: parentDocID,\n config: collectionConfig,\n payload,\n query: findOneArgs,\n req,\n })\n\n // /////////////////////////////////////\n // Update\n // /////////////////////////////////////\n\n let result = await req.payload.db.updateOne({\n id: parentDocID,\n collection: collectionConfig.slug,\n data: rawVersion.version,\n req,\n })\n\n // /////////////////////////////////////\n // Save `previousDoc` as a version after restoring\n // /////////////////////////////////////\n\n const prevVersion = { ...prevDocWithLocales }\n\n delete prevVersion.id\n\n await payload.db.createVersion({\n autosave: false,\n collectionSlug: collectionConfig.slug,\n createdAt: prevVersion.createdAt,\n parent: parentDocID,\n req,\n updatedAt: new Date().toISOString(),\n versionData: rawVersion.version,\n })\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result = await afterRead({\n collection: collectionConfig,\n context: req.context,\n depth,\n doc: result,\n draft: undefined,\n fallbackLocale,\n global: null,\n locale,\n overrideAccess,\n req,\n showHiddenFields,\n })\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: result,\n req,\n })) || result\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterChange - Fields\n // /////////////////////////////////////\n\n result = await afterChange({\n collection: collectionConfig,\n context: req.context,\n data: result,\n doc: result,\n global: null,\n operation: 'update',\n previousDoc: prevDocWithLocales,\n req,\n })\n\n // /////////////////////////////////////\n // afterChange - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterChange.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: result,\n operation: 'update',\n previousDoc: prevDocWithLocales,\n req,\n })) || result\n }, Promise.resolve())\n\n if (shouldCommit) await commitTransaction(req)\n\n return result\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["httpStatus","executeAccess","hasWhereAccessResult","combineQueries","APIError","Forbidden","NotFound","afterChange","afterRead","commitTransaction","initTransaction","killTransaction","getLatestCollectionVersion","restoreVersionOperation","args","id","collection","config","collectionConfig","depth","overrideAccess","req","fallbackLocale","locale","payload","showHiddenFields","shouldCommit","BAD_REQUEST","docs","versionDocs","db","findVersions","slug","limit","where","equals","rawVersion","t","parentDocID","parent","accessResults","access","update","hasWherePolicy","findOneArgs","doc","findOne","prevDocWithLocales","query","result","updateOne","data","version","prevVersion","createVersion","autosave","collectionSlug","createdAt","updatedAt","Date","toISOString","versionData","context","draft","undefined","global","hooks","reduce","priorHook","hook","Promise","resolve","operation","previousDoc","error"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,uCAAuC,GACvC,OAAOA,gBAAgB,cAAa;AAMpC,OAAOC,mBAAmB,8BAA6B;AACvD,SAASC,oBAAoB,QAAQ,sBAAqB;AAC1D,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,wBAAuB;AACrE,SAASC,WAAW,QAAQ,0CAAyC;AACrE,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,0BAA0B,QAAQ,+CAA8C;AAazF,OAAO,MAAMC,0BAA0B,OACrCC;IAEA,MAAM,EACJC,EAAE,EACFC,YAAY,EAAEC,QAAQC,gBAAgB,EAAE,EACxCC,KAAK,EACLC,iBAAiB,KAAK,EACtBC,GAAG,EACHA,KAAK,EAAEC,cAAc,EAAEC,MAAM,EAAEC,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BX,MAAMF;YACNJ,KAAKI;YACLgB,QAAQ;YACRO,WAAW;YACXC,aAAa1B;YACb1B;QACF;QAEA,wCAAwC;QACxC,2BAA2B;QAC3B,wCAAwC;QAExC,MAAMH,iBAAiBgD,KAAK,CAAC3D,WAAW,CAAC4D,MAAM,CAAC,OAAOC,WAAWC;YAChE,MAAMD;YAENnB,SACE,AAAC,MAAMoB,KAAK;gBACVrD,YAAYE;gBACZ4C,SAASzC,IAAIyC,OAAO;gBACpBjB,KAAKI;gBACLuB,WAAW;gBACXC,aAAa1B;gBACb1B;YACF,MAAO4B;QACX,GAAGqB,QAAQC,OAAO;QAElB,IAAI7C,cAAc,MAAMjB,kBAAkBY;QAE1C,OAAO4B;IACT,EAAE,OAAOyB,OAAgB;QACvB,MAAM/D,gBAAgBU;QACtB,MAAMqD;IACR;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/operations/restoreVersion.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport httpStatus from 'http-status'\n\nimport type { FindOneArgs } from '../../database/types.js'\nimport type { PayloadRequestWithData } from '../../types/index.js'\nimport type { Collection, TypeWithID } from '../config/types.js'\n\nimport executeAccess from '../../auth/executeAccess.js'\nimport { hasWhereAccessResult } from '../../auth/types.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { APIError, Forbidden, NotFound } from '../../errors/index.js'\nimport { afterChange } from '../../fields/hooks/afterChange/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { getLatestCollectionVersion } from '../../versions/getLatestCollectionVersion.js'\n\nexport type Arguments = {\n collection: Collection\n currentDepth?: number\n depth?: number\n disableErrors?: boolean\n id: number | string\n overrideAccess?: boolean\n req: PayloadRequestWithData\n showHiddenFields?: boolean\n}\n\nexport const restoreVersionOperation = async <T extends TypeWithID = any>(\n args: Arguments,\n): Promise<T> => {\n const {\n id,\n collection: { config: collectionConfig },\n depth,\n overrideAccess = false,\n req,\n req: { fallbackLocale, locale, payload },\n showHiddenFields,\n } = args\n\n try {\n const shouldCommit = await initTransaction(req)\n\n if (!id) {\n throw new APIError('Missing ID of version to restore.', httpStatus.BAD_REQUEST)\n }\n\n // /////////////////////////////////////\n // Retrieve original raw version\n // /////////////////////////////////////\n\n const { docs: versionDocs } = await req.payload.db.findVersions({\n collection: collectionConfig.slug,\n limit: 1,\n locale,\n pagination: false,\n req,\n where: { id: { equals: id } },\n })\n\n const [rawVersion] = versionDocs\n\n if (!rawVersion) {\n throw new NotFound(req.t)\n }\n\n const parentDocID = rawVersion.parent\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n const accessResults = !overrideAccess\n ? await executeAccess({ id: parentDocID, req }, collectionConfig.access.update)\n : true\n const hasWherePolicy = hasWhereAccessResult(accessResults)\n\n // /////////////////////////////////////\n // Retrieve document\n // /////////////////////////////////////\n\n const findOneArgs: FindOneArgs = {\n collection: collectionConfig.slug,\n locale,\n req,\n where: combineQueries({ id: { equals: parentDocID } }, accessResults),\n }\n\n const doc = await req.payload.db.findOne(findOneArgs)\n\n if (!doc && !hasWherePolicy) throw new NotFound(req.t)\n if (!doc && hasWherePolicy) throw new Forbidden(req.t)\n\n // /////////////////////////////////////\n // fetch previousDoc\n // /////////////////////////////////////\n\n const prevDocWithLocales = await getLatestCollectionVersion({\n id: parentDocID,\n config: collectionConfig,\n payload,\n query: findOneArgs,\n req,\n })\n\n // /////////////////////////////////////\n // Update\n // /////////////////////////////////////\n\n let result = await req.payload.db.updateOne({\n id: parentDocID,\n collection: collectionConfig.slug,\n data: rawVersion.version,\n req,\n })\n\n // /////////////////////////////////////\n // Save `previousDoc` as a version after restoring\n // /////////////////////////////////////\n\n const prevVersion = { ...prevDocWithLocales }\n\n delete prevVersion.id\n\n await payload.db.createVersion({\n autosave: false,\n collectionSlug: collectionConfig.slug,\n createdAt: prevVersion.createdAt,\n parent: parentDocID,\n req,\n updatedAt: new Date().toISOString(),\n versionData: rawVersion.version,\n })\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result = await afterRead({\n collection: collectionConfig,\n context: req.context,\n depth,\n doc: result,\n draft: undefined,\n fallbackLocale,\n global: null,\n locale,\n overrideAccess,\n req,\n showHiddenFields,\n })\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: result,\n req,\n })) || result\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterChange - Fields\n // /////////////////////////////////////\n\n result = await afterChange({\n collection: collectionConfig,\n context: req.context,\n data: result,\n doc: result,\n global: null,\n operation: 'update',\n previousDoc: prevDocWithLocales,\n req,\n })\n\n // /////////////////////////////////////\n // afterChange - Collection\n // /////////////////////////////////////\n\n await collectionConfig.hooks.afterChange.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: result,\n operation: 'update',\n previousDoc: prevDocWithLocales,\n req,\n })) || result\n }, Promise.resolve())\n\n if (shouldCommit) await commitTransaction(req)\n\n return result\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["httpStatus","executeAccess","hasWhereAccessResult","combineQueries","APIError","Forbidden","NotFound","afterChange","afterRead","commitTransaction","initTransaction","killTransaction","getLatestCollectionVersion","restoreVersionOperation","args","id","collection","config","collectionConfig","depth","overrideAccess","req","fallbackLocale","locale","payload","showHiddenFields","shouldCommit","BAD_REQUEST","docs","versionDocs","db","findVersions","slug","limit","pagination","where","equals","rawVersion","t","parentDocID","parent","accessResults","access","update","hasWherePolicy","findOneArgs","doc","findOne","prevDocWithLocales","query","result","updateOne","data","version","prevVersion","createVersion","autosave","collectionSlug","createdAt","updatedAt","Date","toISOString","versionData","context","draft","undefined","global","hooks","reduce","priorHook","hook","Promise","resolve","operation","previousDoc","error"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,uCAAuC,GACvC,OAAOA,gBAAgB,cAAa;AAMpC,OAAOC,mBAAmB,8BAA6B;AACvD,SAASC,oBAAoB,QAAQ,sBAAqB;AAC1D,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,wBAAuB;AACrE,SAASC,WAAW,QAAQ,0CAAyC;AACrE,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,0BAA0B,QAAQ,+CAA8C;AAazF,OAAO,MAAMC,0BAA0B,OACrCC;IAEA,MAAM,EACJC,EAAE,EACFC,YAAY,EAAEC,QAAQC,gBAAgB,EAAE,EACxCC,KAAK,EACLC,iBAAiB,KAAK,EACtBC,GAAG,EACHA,KAAK,EAAEC,cAAc,EAAEC,MAAM,EAAEC,OAAO,EAAE,EACxCC,gBAAgB,EACjB,GAAGX;IAEJ,IAAI;QACF,MAAMY,eAAe,MAAMhB,gBAAgBW;QAE3C,IAAI,CAACN,IAAI;YACP,MAAM,IAAIX,SAAS,qCAAqCJ,WAAW2B,WAAW;QAChF;QAEA,wCAAwC;QACxC,gCAAgC;QAChC,wCAAwC;QAExC,MAAM,EAAEC,MAAMC,WAAW,EAAE,GAAG,MAAMR,IAAIG,OAAO,CAACM,EAAE,CAACC,YAAY,CAAC;YAC9Df,YAAYE,iBAAiBc,IAAI;YACjCC,OAAO;YACP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B;gBACb3B;YACF,MAAO6B;QACX,GAAGqB,QAAQC,OAAO;QAElB,IAAI9C,cAAc,MAAMjB,kBAAkBY;QAE1C,OAAO6B;IACT,EAAE,OAAOyB,OAAgB;QACvB,MAAMhE,gBAAgBU;QACtB,MAAMsD;IACR;AACF,EAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Payload } from '../../index.js';
|
|
2
|
+
import type { MigrationTemplateArgs } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get predefined migration 'up', 'down' and 'imports'
|
|
5
|
+
*/
|
|
6
|
+
export declare const getPredefinedMigration: ({ dirname, file, migrationName: migrationNameArg, payload, }: {
|
|
7
|
+
dirname: string;
|
|
8
|
+
file?: string;
|
|
9
|
+
migrationName?: string;
|
|
10
|
+
payload: Payload;
|
|
11
|
+
}) => Promise<MigrationTemplateArgs>;
|
|
12
|
+
//# sourceMappingURL=getPredefinedMigration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPredefinedMigration.d.ts","sourceRoot":"","sources":["../../../src/database/migrations/getPredefinedMigration.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD;;GAEG;AACH,eAAO,MAAM,sBAAsB,iEAKhC;IACD,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,QAAQ,qBAAqB,CA8BhC,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { pathToFileURL } from 'url';
|
|
4
|
+
/**
|
|
5
|
+
* Get predefined migration 'up', 'down' and 'imports'
|
|
6
|
+
*/ export const getPredefinedMigration = async ({ dirname, file, migrationName: migrationNameArg, payload })=>{
|
|
7
|
+
// Check for predefined migration.
|
|
8
|
+
// Either passed in via --file or prefixed with '@payloadcms/db-mongodb/' for example
|
|
9
|
+
if (file || migrationNameArg?.startsWith('@payloadcms/')) {
|
|
10
|
+
// removes the package name from the migrationName.
|
|
11
|
+
const migrationName = (file || migrationNameArg).split('/').slice(2).join('/');
|
|
12
|
+
let cleanPath = path.join(dirname, `./predefinedMigrations/${migrationName}.mjs`);
|
|
13
|
+
// Check if predefined migration exists
|
|
14
|
+
if (fs.existsSync(cleanPath)) {
|
|
15
|
+
cleanPath = cleanPath.replaceAll('\\', '/');
|
|
16
|
+
const moduleURL = pathToFileURL(cleanPath);
|
|
17
|
+
try {
|
|
18
|
+
const { downSQL, imports, upSQL } = await import(moduleURL.href);
|
|
19
|
+
return {
|
|
20
|
+
downSQL,
|
|
21
|
+
imports,
|
|
22
|
+
upSQL
|
|
23
|
+
};
|
|
24
|
+
} catch (error) {
|
|
25
|
+
payload.logger.error({
|
|
26
|
+
error,
|
|
27
|
+
msg: `Error loading predefined migration ${migrationName}`
|
|
28
|
+
});
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
payload.logger.error({
|
|
33
|
+
msg: `Canned migration ${migrationName} not found.`
|
|
34
|
+
});
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=getPredefinedMigration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/database/migrations/getPredefinedMigration.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport { pathToFileURL } from 'url'\n\nimport type { Payload } from '../../index.js'\nimport type { MigrationTemplateArgs } from '../types.js'\n\n/**\n * Get predefined migration 'up', 'down' and 'imports'\n */\nexport const getPredefinedMigration = async ({\n dirname,\n file,\n migrationName: migrationNameArg,\n payload,\n}: {\n dirname: string\n file?: string\n migrationName?: string\n payload: Payload\n}): Promise<MigrationTemplateArgs> => {\n // Check for predefined migration.\n // Either passed in via --file or prefixed with '@payloadcms/db-mongodb/' for example\n if (file || migrationNameArg?.startsWith('@payloadcms/')) {\n // removes the package name from the migrationName.\n const migrationName = (file || migrationNameArg).split('/').slice(2).join('/')\n let cleanPath = path.join(dirname, `./predefinedMigrations/${migrationName}.mjs`)\n\n // Check if predefined migration exists\n if (fs.existsSync(cleanPath)) {\n cleanPath = cleanPath.replaceAll('\\\\', '/')\n const moduleURL = pathToFileURL(cleanPath)\n try {\n const { downSQL, imports, upSQL } = await import(moduleURL.href)\n return { downSQL, imports, upSQL }\n } catch (error) {\n payload.logger.error({\n error,\n msg: `Error loading predefined migration ${migrationName}`,\n })\n process.exit(1)\n }\n } else {\n payload.logger.error({\n msg: `Canned migration ${migrationName} not found.`,\n })\n process.exit(1)\n }\n }\n return {}\n}\n"],"names":["fs","path","pathToFileURL","getPredefinedMigration","dirname","file","migrationName","migrationNameArg","payload","startsWith","split","slice","join","cleanPath","existsSync","replaceAll","moduleURL","downSQL","imports","upSQL","href","error","logger","msg","process","exit"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,SAASC,aAAa,QAAQ,MAAK;AAKnC;;CAEC,GACD,OAAO,MAAMC,yBAAyB,OAAO,EAC3CC,OAAO,EACPC,IAAI,EACJC,eAAeC,gBAAgB,EAC/BC,OAAO,EAMR;IACC,kCAAkC;IAClC,qFAAqF;IACrF,IAAIH,QAAQE,kBAAkBE,WAAW,iBAAiB;QACxD,mDAAmD;QACnD,MAAMH,gBAAgB,AAACD,CAAAA,QAAQE,gBAAe,EAAGG,KAAK,CAAC,KAAKC,KAAK,CAAC,GAAGC,IAAI,CAAC;QAC1E,IAAIC,YAAYZ,KAAKW,IAAI,CAACR,SAAS,CAAC,uBAAuB,EAAEE,cAAc,IAAI,CAAC;QAEhF,uCAAuC;QACvC,IAAIN,GAAGc,UAAU,CAACD,YAAY;YAC5BA,YAAYA,UAAUE,UAAU,CAAC,MAAM;YACvC,MAAMC,YAAYd,cAAcW;YAChC,IAAI;gBACF,MAAM,EAAEI,OAAO,EAAEC,OAAO,EAAEC,KAAK,EAAE,GAAG,MAAM,MAAM,CAACH,UAAUI,IAAI;gBAC/D,OAAO;oBAAEH;oBAASC;oBAASC;gBAAM;YACnC,EAAE,OAAOE,OAAO;gBACdb,QAAQc,MAAM,CAACD,KAAK,CAAC;oBACnBA;oBACAE,KAAK,CAAC,mCAAmC,EAAEjB,cAAc,CAAC;gBAC5D;gBACAkB,QAAQC,IAAI,CAAC;YACf;QACF,OAAO;YACLjB,QAAQc,MAAM,CAACD,KAAK,CAAC;gBACnBE,KAAK,CAAC,iBAAiB,EAAEjB,cAAc,WAAW,CAAC;YACrD;YACAkB,QAAQC,IAAI,CAAC;QACf;IACF;IACA,OAAO,CAAC;AACV,EAAC"}
|
package/dist/database/types.d.ts
CHANGED
|
@@ -331,4 +331,9 @@ export type DBIdentifierName = ((Args: {
|
|
|
331
331
|
/** The name of the parent table when using relational DBs */
|
|
332
332
|
tableName?: string;
|
|
333
333
|
}) => string) | string;
|
|
334
|
+
export type MigrationTemplateArgs = {
|
|
335
|
+
downSQL?: string;
|
|
336
|
+
imports?: string;
|
|
337
|
+
upSQL?: string;
|
|
338
|
+
};
|
|
334
339
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/database/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACjF,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,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MAAM,CAAA;CACf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/database/types.ts"],"sourcesContent":["import type { TypeWithID } from '../collections/config/types.js'\nimport type { TypeWithID as GlobalsTypeWithID } from '../globals/config/types.js'\nimport type { Document, Payload, PayloadRequestWithData, Where } from '../types/index.js'\nimport type { TypeWithVersion } from '../versions/types.js'\n\nexport type { TypeWithVersion }\n\nexport interface BaseDatabaseAdapter {\n /**\n * Start a transaction, requiring commitTransaction() to be called for any changes to be made.\n * @returns an identifier for the transaction or null if one cannot be established\n */\n beginTransaction?: BeginTransaction\n /**\n * Persist the changes made since the start of the transaction.\n */\n commitTransaction?: CommitTransaction\n\n /**\n * Open the connection to the database\n */\n connect?: Connect\n\n count: Count\n\n create: Create\n\n createGlobal: CreateGlobal\n\n createGlobalVersion: CreateGlobalVersion\n /**\n * Output a migration file\n */\n createMigration: CreateMigration\n\n createVersion: CreateVersion\n\n /**\n * Specify if the ID is a text or number field by default within this database adapter.\n */\n defaultIDType: 'number' | 'text'\n\n deleteMany: DeleteMany\n\n deleteOne: DeleteOne\n\n deleteVersions: DeleteVersions\n\n /**\n * Terminate the connection with the database\n */\n destroy?: Destroy\n\n find: <T = TypeWithID>(args: FindArgs) => Promise<PaginatedDocs<T>>\n\n findGlobal: FindGlobal\n\n findGlobalVersions: FindGlobalVersions\n\n findOne: FindOne\n\n findVersions: FindVersions\n\n /**\n * Perform startup tasks required to interact with the database such as building Schema and models\n */\n init?: Init\n\n /**\n * Run any migration up functions that have not yet been performed and update the status\n */\n migrate: () => Promise<void>\n\n /**\n * Run any migration down functions that have been performed\n */\n migrateDown: () => Promise<void>\n\n /**\n * Drop the current database and run all migrate up functions\n */\n migrateFresh: (args: { forceAcceptWarning?: boolean }) => Promise<void>\n /**\n * Run all migration down functions before running up\n */\n migrateRefresh: () => Promise<void>\n\n /**\n * Run all migrate down functions\n */\n migrateReset: () => Promise<void>\n /**\n * Read the current state of migrations and output the result to show which have been run\n */\n migrateStatus: () => Promise<void>\n /**\n * Path to read and write migration files from\n */\n migrationDir: string\n /**\n * The name of the database adapter\n */\n name: string\n /**\n * reference to the instance of payload\n */\n payload: Payload\n\n queryDrafts: QueryDrafts\n /**\n * Abort any changes since the start of the transaction.\n */\n rollbackTransaction?: RollbackTransaction\n /**\n * A key-value store of all sessions open (used for transactions)\n */\n sessions?: {\n [id: string]: {\n db: unknown\n reject: () => Promise<void>\n resolve: () => Promise<void>\n }\n }\n\n updateGlobal: UpdateGlobal\n\n updateGlobalVersion: UpdateGlobalVersion\n\n updateOne: UpdateOne\n\n updateVersion: UpdateVersion\n}\n\nexport type Init = () => Promise<void> | void\n\ntype ConnectArgs = {\n hotReload: boolean\n}\n\nexport type Connect = (args?: ConnectArgs) => Promise<void>\n\nexport type Destroy = () => Promise<void>\n\nexport type CreateMigration = (args: {\n file?: string\n /**\n * Skips the prompt asking to create empty migrations\n */\n forceAcceptWarning?: boolean\n migrationName?: string\n payload: Payload\n}) => Promise<void>\n\nexport type Transaction = (\n callback: () => Promise<void>,\n options?: Record<string, unknown>,\n) => Promise<void>\n\nexport type BeginTransaction = (\n options?: Record<string, unknown>,\n) => Promise<null | number | string>\n\nexport type RollbackTransaction = (id: number | string) => Promise<void>\n\nexport type CommitTransaction = (id: number | string) => Promise<void>\n\nexport type QueryDraftsArgs = {\n collection: string\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n req: PayloadRequestWithData\n sort?: string\n where?: Where\n}\n\nexport type QueryDrafts = <T = TypeWithID>(args: QueryDraftsArgs) => Promise<PaginatedDocs<T>>\n\nexport type FindOneArgs = {\n collection: string\n locale?: string\n req: PayloadRequestWithData\n where?: Where\n}\n\nexport type FindOne = <T extends TypeWithID>(args: FindOneArgs) => Promise<T | null>\n\nexport type FindArgs = {\n collection: string\n /** Setting limit to 1 is equal to the previous Model.findOne(). Setting limit to 0 disables the limit */\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n req: PayloadRequestWithData\n skip?: number\n sort?: string\n versions?: boolean\n where?: Where\n}\n\nexport type Find = <T = TypeWithID>(args: FindArgs) => Promise<PaginatedDocs<T>>\n\nexport type CountArgs = {\n collection: string\n locale?: string\n req: PayloadRequestWithData\n where?: Where\n}\n\nexport type Count = (args: CountArgs) => Promise<{ totalDocs: number }>\n\ntype BaseVersionArgs = {\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n req: PayloadRequestWithData\n skip?: number\n sort?: string\n versions?: boolean\n where?: Where\n}\n\nexport type FindVersionsArgs = BaseVersionArgs & {\n collection: string\n}\n\nexport type FindVersions = <T = TypeWithID>(\n args: FindVersionsArgs,\n) => Promise<PaginatedDocs<TypeWithVersion<T>>>\n\nexport type FindGlobalVersionsArgs = BaseVersionArgs & {\n global: string\n}\n\nexport type FindGlobalArgs = {\n locale?: string\n req: PayloadRequestWithData\n slug: string\n where?: Where\n}\n\nexport type UpdateGlobalVersionArgs<T = TypeWithID> = {\n global: string\n locale?: string\n req: PayloadRequestWithData\n versionData: T\n} & (\n | {\n id: number | string\n where?: never\n }\n | {\n id?: never\n where: Where\n }\n)\n\nexport type UpdateGlobalVersion = <T extends TypeWithID = TypeWithID>(\n args: UpdateGlobalVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type FindGlobal = <T extends GlobalsTypeWithID = any>(args: FindGlobalArgs) => Promise<T>\n\nexport type CreateGlobalArgs<T extends GlobalsTypeWithID = any> = {\n data: T\n req: PayloadRequestWithData\n slug: string\n}\nexport type CreateGlobal = <T extends GlobalsTypeWithID = any>(\n args: CreateGlobalArgs<T>,\n) => Promise<T>\n\nexport type UpdateGlobalArgs<T extends GlobalsTypeWithID = any> = {\n data: T\n req: PayloadRequestWithData\n slug: string\n}\nexport type UpdateGlobal = <T extends GlobalsTypeWithID = any>(\n args: UpdateGlobalArgs<T>,\n) => Promise<T>\n// export type UpdateOne = (args: UpdateOneArgs) => Promise<Document>\n\nexport type FindGlobalVersions = <T = TypeWithID>(\n args: FindGlobalVersionsArgs,\n) => Promise<PaginatedDocs<TypeWithVersion<T>>>\n\nexport type DeleteVersionsArgs = {\n collection: string\n locale?: string\n req: PayloadRequestWithData\n sort?: {\n [key: string]: string\n }\n where: Where\n}\n\nexport type CreateVersionArgs<T = TypeWithID> = {\n autosave: boolean\n collectionSlug: string\n createdAt: string\n /** ID of the parent document for which the version should be created for */\n parent: number | string\n req: PayloadRequestWithData\n updatedAt: string\n versionData: T\n}\n\nexport type CreateVersion = <T extends TypeWithID = TypeWithID>(\n args: CreateVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type CreateGlobalVersionArgs<T = TypeWithID> = {\n autosave: boolean\n createdAt: string\n globalSlug: string\n /** ID of the parent document for which the version should be created for */\n parent: number | string\n req: PayloadRequestWithData\n updatedAt: string\n versionData: T\n}\n\nexport type CreateGlobalVersion = <T extends TypeWithID = TypeWithID>(\n args: CreateGlobalVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type DeleteVersions = (args: DeleteVersionsArgs) => Promise<void>\n\nexport type UpdateVersionArgs<T = TypeWithID> = {\n collection: string\n locale?: string\n req: PayloadRequestWithData\n versionData: T\n} & (\n | {\n id: number | string\n where?: never\n }\n | {\n id?: never\n where: Where\n }\n)\n\nexport type UpdateVersion = <T extends TypeWithID = TypeWithID>(\n args: UpdateVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type CreateArgs = {\n collection: string\n data: Record<string, unknown>\n draft?: boolean\n locale?: string\n req: PayloadRequestWithData\n}\n\nexport type Create = (args: CreateArgs) => Promise<Document>\n\nexport type UpdateOneArgs = {\n collection: string\n data: Record<string, unknown>\n draft?: boolean\n locale?: string\n req: PayloadRequestWithData\n} & (\n | {\n id: number | string\n where?: never\n }\n | {\n id?: never\n where: Where\n }\n)\n\nexport type UpdateOne = (args: UpdateOneArgs) => Promise<Document>\n\nexport type DeleteOneArgs = {\n collection: string\n req: PayloadRequestWithData\n where: Where\n}\n\nexport type DeleteOne = (args: DeleteOneArgs) => Promise<Document>\n\nexport type DeleteManyArgs = {\n collection: string\n req: PayloadRequestWithData\n where: Where\n}\n\nexport type DeleteMany = (args: DeleteManyArgs) => Promise<void>\n\nexport type Migration = MigrationData & {\n down: ({ payload, req }: { payload: Payload; req: PayloadRequestWithData }) => Promise<boolean>\n up: ({ payload, req }: { payload: Payload; req: PayloadRequestWithData }) => Promise<boolean>\n}\n\nexport type MigrationData = {\n batch?: number\n id?: string\n name: string\n}\n\nexport type PaginatedDocs<T = any> = {\n docs: T[]\n hasNextPage: boolean\n hasPrevPage: boolean\n limit: number\n nextPage?: null | number | undefined\n page?: number\n pagingCounter: number\n prevPage?: null | number | undefined\n totalDocs: number\n totalPages: number\n}\n\nexport type DatabaseAdapterResult<T = BaseDatabaseAdapter> = {\n defaultIDType: 'number' | 'text'\n init: (args: { payload: Payload }) => T\n}\n\nexport type DBIdentifierName =\n | ((Args: {\n /** The name of the parent table when using relational DBs */\n tableName?: string\n }) => string)\n | string\n"],"names":[],"rangeMappings":"","mappings":"AAyaA,WAKU"}
|
|
1
|
+
{"version":3,"sources":["../../src/database/types.ts"],"sourcesContent":["import type { TypeWithID } from '../collections/config/types.js'\nimport type { TypeWithID as GlobalsTypeWithID } from '../globals/config/types.js'\nimport type { Document, Payload, PayloadRequestWithData, Where } from '../types/index.js'\nimport type { TypeWithVersion } from '../versions/types.js'\n\nexport type { TypeWithVersion }\n\nexport interface BaseDatabaseAdapter {\n /**\n * Start a transaction, requiring commitTransaction() to be called for any changes to be made.\n * @returns an identifier for the transaction or null if one cannot be established\n */\n beginTransaction?: BeginTransaction\n /**\n * Persist the changes made since the start of the transaction.\n */\n commitTransaction?: CommitTransaction\n\n /**\n * Open the connection to the database\n */\n connect?: Connect\n\n count: Count\n\n create: Create\n\n createGlobal: CreateGlobal\n\n createGlobalVersion: CreateGlobalVersion\n /**\n * Output a migration file\n */\n createMigration: CreateMigration\n\n createVersion: CreateVersion\n\n /**\n * Specify if the ID is a text or number field by default within this database adapter.\n */\n defaultIDType: 'number' | 'text'\n\n deleteMany: DeleteMany\n\n deleteOne: DeleteOne\n\n deleteVersions: DeleteVersions\n\n /**\n * Terminate the connection with the database\n */\n destroy?: Destroy\n\n find: <T = TypeWithID>(args: FindArgs) => Promise<PaginatedDocs<T>>\n\n findGlobal: FindGlobal\n\n findGlobalVersions: FindGlobalVersions\n\n findOne: FindOne\n\n findVersions: FindVersions\n\n /**\n * Perform startup tasks required to interact with the database such as building Schema and models\n */\n init?: Init\n\n /**\n * Run any migration up functions that have not yet been performed and update the status\n */\n migrate: () => Promise<void>\n\n /**\n * Run any migration down functions that have been performed\n */\n migrateDown: () => Promise<void>\n\n /**\n * Drop the current database and run all migrate up functions\n */\n migrateFresh: (args: { forceAcceptWarning?: boolean }) => Promise<void>\n /**\n * Run all migration down functions before running up\n */\n migrateRefresh: () => Promise<void>\n\n /**\n * Run all migrate down functions\n */\n migrateReset: () => Promise<void>\n /**\n * Read the current state of migrations and output the result to show which have been run\n */\n migrateStatus: () => Promise<void>\n /**\n * Path to read and write migration files from\n */\n migrationDir: string\n /**\n * The name of the database adapter\n */\n name: string\n /**\n * reference to the instance of payload\n */\n payload: Payload\n\n queryDrafts: QueryDrafts\n /**\n * Abort any changes since the start of the transaction.\n */\n rollbackTransaction?: RollbackTransaction\n /**\n * A key-value store of all sessions open (used for transactions)\n */\n sessions?: {\n [id: string]: {\n db: unknown\n reject: () => Promise<void>\n resolve: () => Promise<void>\n }\n }\n\n updateGlobal: UpdateGlobal\n\n updateGlobalVersion: UpdateGlobalVersion\n\n updateOne: UpdateOne\n\n updateVersion: UpdateVersion\n}\n\nexport type Init = () => Promise<void> | void\n\ntype ConnectArgs = {\n hotReload: boolean\n}\n\nexport type Connect = (args?: ConnectArgs) => Promise<void>\n\nexport type Destroy = () => Promise<void>\n\nexport type CreateMigration = (args: {\n file?: string\n /**\n * Skips the prompt asking to create empty migrations\n */\n forceAcceptWarning?: boolean\n migrationName?: string\n payload: Payload\n}) => Promise<void>\n\nexport type Transaction = (\n callback: () => Promise<void>,\n options?: Record<string, unknown>,\n) => Promise<void>\n\nexport type BeginTransaction = (\n options?: Record<string, unknown>,\n) => Promise<null | number | string>\n\nexport type RollbackTransaction = (id: number | string) => Promise<void>\n\nexport type CommitTransaction = (id: number | string) => Promise<void>\n\nexport type QueryDraftsArgs = {\n collection: string\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n req: PayloadRequestWithData\n sort?: string\n where?: Where\n}\n\nexport type QueryDrafts = <T = TypeWithID>(args: QueryDraftsArgs) => Promise<PaginatedDocs<T>>\n\nexport type FindOneArgs = {\n collection: string\n locale?: string\n req: PayloadRequestWithData\n where?: Where\n}\n\nexport type FindOne = <T extends TypeWithID>(args: FindOneArgs) => Promise<T | null>\n\nexport type FindArgs = {\n collection: string\n /** Setting limit to 1 is equal to the previous Model.findOne(). Setting limit to 0 disables the limit */\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n req: PayloadRequestWithData\n skip?: number\n sort?: string\n versions?: boolean\n where?: Where\n}\n\nexport type Find = <T = TypeWithID>(args: FindArgs) => Promise<PaginatedDocs<T>>\n\nexport type CountArgs = {\n collection: string\n locale?: string\n req: PayloadRequestWithData\n where?: Where\n}\n\nexport type Count = (args: CountArgs) => Promise<{ totalDocs: number }>\n\ntype BaseVersionArgs = {\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n req: PayloadRequestWithData\n skip?: number\n sort?: string\n versions?: boolean\n where?: Where\n}\n\nexport type FindVersionsArgs = BaseVersionArgs & {\n collection: string\n}\n\nexport type FindVersions = <T = TypeWithID>(\n args: FindVersionsArgs,\n) => Promise<PaginatedDocs<TypeWithVersion<T>>>\n\nexport type FindGlobalVersionsArgs = BaseVersionArgs & {\n global: string\n}\n\nexport type FindGlobalArgs = {\n locale?: string\n req: PayloadRequestWithData\n slug: string\n where?: Where\n}\n\nexport type UpdateGlobalVersionArgs<T = TypeWithID> = {\n global: string\n locale?: string\n req: PayloadRequestWithData\n versionData: T\n} & (\n | {\n id: number | string\n where?: never\n }\n | {\n id?: never\n where: Where\n }\n)\n\nexport type UpdateGlobalVersion = <T extends TypeWithID = TypeWithID>(\n args: UpdateGlobalVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type FindGlobal = <T extends GlobalsTypeWithID = any>(args: FindGlobalArgs) => Promise<T>\n\nexport type CreateGlobalArgs<T extends GlobalsTypeWithID = any> = {\n data: T\n req: PayloadRequestWithData\n slug: string\n}\nexport type CreateGlobal = <T extends GlobalsTypeWithID = any>(\n args: CreateGlobalArgs<T>,\n) => Promise<T>\n\nexport type UpdateGlobalArgs<T extends GlobalsTypeWithID = any> = {\n data: T\n req: PayloadRequestWithData\n slug: string\n}\nexport type UpdateGlobal = <T extends GlobalsTypeWithID = any>(\n args: UpdateGlobalArgs<T>,\n) => Promise<T>\n// export type UpdateOne = (args: UpdateOneArgs) => Promise<Document>\n\nexport type FindGlobalVersions = <T = TypeWithID>(\n args: FindGlobalVersionsArgs,\n) => Promise<PaginatedDocs<TypeWithVersion<T>>>\n\nexport type DeleteVersionsArgs = {\n collection: string\n locale?: string\n req: PayloadRequestWithData\n sort?: {\n [key: string]: string\n }\n where: Where\n}\n\nexport type CreateVersionArgs<T = TypeWithID> = {\n autosave: boolean\n collectionSlug: string\n createdAt: string\n /** ID of the parent document for which the version should be created for */\n parent: number | string\n req: PayloadRequestWithData\n updatedAt: string\n versionData: T\n}\n\nexport type CreateVersion = <T extends TypeWithID = TypeWithID>(\n args: CreateVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type CreateGlobalVersionArgs<T = TypeWithID> = {\n autosave: boolean\n createdAt: string\n globalSlug: string\n /** ID of the parent document for which the version should be created for */\n parent: number | string\n req: PayloadRequestWithData\n updatedAt: string\n versionData: T\n}\n\nexport type CreateGlobalVersion = <T extends TypeWithID = TypeWithID>(\n args: CreateGlobalVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type DeleteVersions = (args: DeleteVersionsArgs) => Promise<void>\n\nexport type UpdateVersionArgs<T = TypeWithID> = {\n collection: string\n locale?: string\n req: PayloadRequestWithData\n versionData: T\n} & (\n | {\n id: number | string\n where?: never\n }\n | {\n id?: never\n where: Where\n }\n)\n\nexport type UpdateVersion = <T extends TypeWithID = TypeWithID>(\n args: UpdateVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type CreateArgs = {\n collection: string\n data: Record<string, unknown>\n draft?: boolean\n locale?: string\n req: PayloadRequestWithData\n}\n\nexport type Create = (args: CreateArgs) => Promise<Document>\n\nexport type UpdateOneArgs = {\n collection: string\n data: Record<string, unknown>\n draft?: boolean\n locale?: string\n req: PayloadRequestWithData\n} & (\n | {\n id: number | string\n where?: never\n }\n | {\n id?: never\n where: Where\n }\n)\n\nexport type UpdateOne = (args: UpdateOneArgs) => Promise<Document>\n\nexport type DeleteOneArgs = {\n collection: string\n req: PayloadRequestWithData\n where: Where\n}\n\nexport type DeleteOne = (args: DeleteOneArgs) => Promise<Document>\n\nexport type DeleteManyArgs = {\n collection: string\n req: PayloadRequestWithData\n where: Where\n}\n\nexport type DeleteMany = (args: DeleteManyArgs) => Promise<void>\n\nexport type Migration = MigrationData & {\n down: ({ payload, req }: { payload: Payload; req: PayloadRequestWithData }) => Promise<boolean>\n up: ({ payload, req }: { payload: Payload; req: PayloadRequestWithData }) => Promise<boolean>\n}\n\nexport type MigrationData = {\n batch?: number\n id?: string\n name: string\n}\n\nexport type PaginatedDocs<T = any> = {\n docs: T[]\n hasNextPage: boolean\n hasPrevPage: boolean\n limit: number\n nextPage?: null | number | undefined\n page?: number\n pagingCounter: number\n prevPage?: null | number | undefined\n totalDocs: number\n totalPages: number\n}\n\nexport type DatabaseAdapterResult<T = BaseDatabaseAdapter> = {\n defaultIDType: 'number' | 'text'\n init: (args: { payload: Payload }) => T\n}\n\nexport type DBIdentifierName =\n | ((Args: {\n /** The name of the parent table when using relational DBs */\n tableName?: string\n }) => string)\n | string\n\nexport type MigrationTemplateArgs = {\n downSQL?: string\n imports?: string\n upSQL?: string\n}\n"],"names":[],"rangeMappings":"","mappings":"AAgbA,WAIC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { BaseDatabaseAdapter, BeginTransaction, CommitTransaction, Connect, Count, CountArgs, Create, CreateArgs, CreateGlobal, CreateGlobalArgs, CreateGlobalVersion, CreateGlobalVersionArgs, CreateMigration, CreateVersion, CreateVersionArgs, DBIdentifierName, DatabaseAdapterResult as DatabaseAdapterObj, DeleteMany, DeleteManyArgs, DeleteOne, DeleteOneArgs, DeleteVersions, DeleteVersionsArgs, Destroy, Find, FindArgs, FindGlobal, FindGlobalArgs, FindGlobalVersions, FindGlobalVersionsArgs, FindOne, FindOneArgs, FindVersions, FindVersionsArgs, Init, Migration, MigrationData, PaginatedDocs, QueryDrafts, QueryDraftsArgs, RollbackTransaction, Transaction, TypeWithVersion, UpdateGlobal, UpdateGlobalArgs, UpdateGlobalVersion, UpdateGlobalVersionArgs, UpdateOne, UpdateOneArgs, UpdateVersion, UpdateVersionArgs, } from '../database/types.js';
|
|
1
|
+
export type { BaseDatabaseAdapter, BeginTransaction, CommitTransaction, Connect, Count, CountArgs, Create, CreateArgs, CreateGlobal, CreateGlobalArgs, CreateGlobalVersion, CreateGlobalVersionArgs, CreateMigration, CreateVersion, CreateVersionArgs, DBIdentifierName, DatabaseAdapterResult as DatabaseAdapterObj, DeleteMany, DeleteManyArgs, DeleteOne, DeleteOneArgs, DeleteVersions, DeleteVersionsArgs, Destroy, Find, FindArgs, FindGlobal, FindGlobalArgs, FindGlobalVersions, FindGlobalVersionsArgs, FindOne, FindOneArgs, FindVersions, FindVersionsArgs, Init, Migration, MigrationData, MigrationTemplateArgs, PaginatedDocs, QueryDrafts, QueryDraftsArgs, RollbackTransaction, Transaction, TypeWithVersion, UpdateGlobal, UpdateGlobalArgs, UpdateGlobalVersion, UpdateGlobalVersionArgs, UpdateOne, UpdateOneArgs, UpdateVersion, UpdateVersionArgs, } from '../database/types.js';
|
|
2
2
|
export * from '../database/queryValidation/types.js';
|
|
3
3
|
export { combineQueries } from '../database/combineQueries.js';
|
|
4
4
|
export { createDatabaseAdapter } from '../database/createDatabaseAdapter.js';
|
|
@@ -6,6 +6,7 @@ export { default as flattenWhereToOperators } from '../database/flattenWhereToOp
|
|
|
6
6
|
export { getLocalizedPaths } from '../database/getLocalizedPaths.js';
|
|
7
7
|
export { createMigration } from '../database/migrations/createMigration.js';
|
|
8
8
|
export { getMigrations } from '../database/migrations/getMigrations.js';
|
|
9
|
+
export { getPredefinedMigration } from '../database/migrations/getPredefinedMigration.js';
|
|
9
10
|
export { migrate } from '../database/migrations/migrate.js';
|
|
10
11
|
export { migrateDown } from '../database/migrations/migrateDown.js';
|
|
11
12
|
export { migrateRefresh } from '../database/migrations/migrateRefresh.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/exports/database.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,EACP,KAAK,EACL,SAAS,EACT,MAAM,EACN,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,IAAI,kBAAkB,EAC3C,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,OAAO,EACP,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,IAAI,EACJ,SAAS,EACT,aAAa,EACb,aAAa,EACb,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,SAAS,EACT,a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cAAc,EAAE,MAAM,0CAA0C,CAAA;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAE/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAA;AAErF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AAEjF,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAEvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAA;AAEtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAA;AAEzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA"}
|
package/dist/exports/database.js
CHANGED
|
@@ -5,6 +5,7 @@ export { default as flattenWhereToOperators } from '../database/flattenWhereToOp
|
|
|
5
5
|
export { getLocalizedPaths } from '../database/getLocalizedPaths.js';
|
|
6
6
|
export { createMigration } from '../database/migrations/createMigration.js';
|
|
7
7
|
export { getMigrations } from '../database/migrations/getMigrations.js';
|
|
8
|
+
export { getPredefinedMigration } from '../database/migrations/getPredefinedMigration.js';
|
|
8
9
|
export { migrate } from '../database/migrations/migrate.js';
|
|
9
10
|
export { migrateDown } from '../database/migrations/migrateDown.js';
|
|
10
11
|
export { migrateRefresh } from '../database/migrations/migrateRefresh.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/database.ts"],"sourcesContent":["export type {\n BaseDatabaseAdapter,\n BeginTransaction,\n CommitTransaction,\n Connect,\n Count,\n CountArgs,\n Create,\n CreateArgs,\n CreateGlobal,\n CreateGlobalArgs,\n CreateGlobalVersion,\n CreateGlobalVersionArgs,\n CreateMigration,\n CreateVersion,\n CreateVersionArgs,\n DBIdentifierName,\n DatabaseAdapterResult as DatabaseAdapterObj,\n DeleteMany,\n DeleteManyArgs,\n DeleteOne,\n DeleteOneArgs,\n DeleteVersions,\n DeleteVersionsArgs,\n Destroy,\n Find,\n FindArgs,\n FindGlobal,\n FindGlobalArgs,\n FindGlobalVersions,\n FindGlobalVersionsArgs,\n FindOne,\n FindOneArgs,\n FindVersions,\n FindVersionsArgs,\n Init,\n Migration,\n MigrationData,\n PaginatedDocs,\n QueryDrafts,\n QueryDraftsArgs,\n RollbackTransaction,\n Transaction,\n TypeWithVersion,\n UpdateGlobal,\n UpdateGlobalArgs,\n UpdateGlobalVersion,\n UpdateGlobalVersionArgs,\n UpdateOne,\n UpdateOneArgs,\n UpdateVersion,\n UpdateVersionArgs,\n} from '../database/types.js'\n\nexport * from '../database/queryValidation/types.js'\n\nexport { combineQueries } from '../database/combineQueries.js'\n\nexport { createDatabaseAdapter } from '../database/createDatabaseAdapter.js'\n\nexport { default as flattenWhereToOperators } from '../database/flattenWhereToOperators.js'\n\nexport { getLocalizedPaths } from '../database/getLocalizedPaths.js'\n\nexport { createMigration } from '../database/migrations/createMigration.js'\n\nexport { getMigrations } from '../database/migrations/getMigrations.js'\n\nexport { migrate } from '../database/migrations/migrate.js'\n\nexport { migrateDown } from '../database/migrations/migrateDown.js'\n\nexport { migrateRefresh } from '../database/migrations/migrateRefresh.js'\n\nexport { migrateReset } from '../database/migrations/migrateReset.js'\n\nexport { migrateStatus } from '../database/migrations/migrateStatus.js'\n\nexport { migrationTemplate } from '../database/migrations/migrationTemplate.js'\n\nexport { migrationsCollection } from '../database/migrations/migrationsCollection.js'\n\nexport { readMigrationFiles } from '../database/migrations/readMigrationFiles.js'\n\nexport type { EntityPolicies, PathToQuery } from '../database/queryValidation/types.js'\n\nexport { validateQueryPaths } from '../database/queryValidation/validateQueryPaths.js'\n\nexport { validateSearchParam } from '../database/queryValidation/validateSearchParams.js'\n\nexport { commitTransaction } from '../utilities/commitTransaction.js'\nexport { initTransaction } from '../utilities/initTransaction.js'\nexport { killTransaction } from '../utilities/killTransaction.js'\n"],"names":["combineQueries","createDatabaseAdapter","default","flattenWhereToOperators","getLocalizedPaths","createMigration","getMigrations","migrate","migrateDown","migrateRefresh","migrateReset","migrateStatus","migrationTemplate","migrationsCollection","readMigrationFiles","validateQueryPaths","validateSearchParam","commitTransaction","initTransaction","killTransaction"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/exports/database.ts"],"sourcesContent":["export type {\n BaseDatabaseAdapter,\n BeginTransaction,\n CommitTransaction,\n Connect,\n Count,\n CountArgs,\n Create,\n CreateArgs,\n CreateGlobal,\n CreateGlobalArgs,\n CreateGlobalVersion,\n CreateGlobalVersionArgs,\n CreateMigration,\n CreateVersion,\n CreateVersionArgs,\n DBIdentifierName,\n DatabaseAdapterResult as DatabaseAdapterObj,\n DeleteMany,\n DeleteManyArgs,\n DeleteOne,\n DeleteOneArgs,\n DeleteVersions,\n DeleteVersionsArgs,\n Destroy,\n Find,\n FindArgs,\n FindGlobal,\n FindGlobalArgs,\n FindGlobalVersions,\n FindGlobalVersionsArgs,\n FindOne,\n FindOneArgs,\n FindVersions,\n FindVersionsArgs,\n Init,\n Migration,\n MigrationData,\n MigrationTemplateArgs,\n PaginatedDocs,\n QueryDrafts,\n QueryDraftsArgs,\n RollbackTransaction,\n Transaction,\n TypeWithVersion,\n UpdateGlobal,\n UpdateGlobalArgs,\n UpdateGlobalVersion,\n UpdateGlobalVersionArgs,\n UpdateOne,\n UpdateOneArgs,\n UpdateVersion,\n UpdateVersionArgs,\n} from '../database/types.js'\n\nexport * from '../database/queryValidation/types.js'\n\nexport { combineQueries } from '../database/combineQueries.js'\n\nexport { createDatabaseAdapter } from '../database/createDatabaseAdapter.js'\n\nexport { default as flattenWhereToOperators } from '../database/flattenWhereToOperators.js'\n\nexport { getLocalizedPaths } from '../database/getLocalizedPaths.js'\n\nexport { createMigration } from '../database/migrations/createMigration.js'\n\nexport { getMigrations } from '../database/migrations/getMigrations.js'\n\nexport { getPredefinedMigration } from '../database/migrations/getPredefinedMigration.js'\n\nexport { migrate } from '../database/migrations/migrate.js'\n\nexport { migrateDown } from '../database/migrations/migrateDown.js'\n\nexport { migrateRefresh } from '../database/migrations/migrateRefresh.js'\n\nexport { migrateReset } from '../database/migrations/migrateReset.js'\n\nexport { migrateStatus } from '../database/migrations/migrateStatus.js'\n\nexport { migrationTemplate } from '../database/migrations/migrationTemplate.js'\n\nexport { migrationsCollection } from '../database/migrations/migrationsCollection.js'\n\nexport { readMigrationFiles } from '../database/migrations/readMigrationFiles.js'\n\nexport type { EntityPolicies, PathToQuery } from '../database/queryValidation/types.js'\n\nexport { validateQueryPaths } from '../database/queryValidation/validateQueryPaths.js'\n\nexport { validateSearchParam } from '../database/queryValidation/validateSearchParams.js'\n\nexport { commitTransaction } from '../utilities/commitTransaction.js'\nexport { initTransaction } from '../utilities/initTransaction.js'\nexport { killTransaction } from '../utilities/killTransaction.js'\n"],"names":["combineQueries","createDatabaseAdapter","default","flattenWhereToOperators","getLocalizedPaths","createMigration","getMigrations","getPredefinedMigration","migrate","migrateDown","migrateRefresh","migrateReset","migrateStatus","migrationTemplate","migrationsCollection","readMigrationFiles","validateQueryPaths","validateSearchParam","commitTransaction","initTransaction","killTransaction"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":"AAuDA,cAAc,uCAAsC;AAEpD,SAASA,cAAc,QAAQ,gCAA+B;AAE9D,SAASC,qBAAqB,QAAQ,uCAAsC;AAE5E,SAASC,WAAWC,uBAAuB,QAAQ,yCAAwC;AAE3F,SAASC,iBAAiB,QAAQ,mCAAkC;AAEpE,SAASC,eAAe,QAAQ,4CAA2C;AAE3E,SAASC,aAAa,QAAQ,0CAAyC;AAEvE,SAASC,sBAAsB,QAAQ,mDAAkD;AAEzF,SAASC,OAAO,QAAQ,oCAAmC;AAE3D,SAASC,WAAW,QAAQ,wCAAuC;AAEnE,SAASC,cAAc,QAAQ,2CAA0C;AAEzE,SAASC,YAAY,QAAQ,yCAAwC;AAErE,SAASC,aAAa,QAAQ,0CAAyC;AAEvE,SAASC,iBAAiB,QAAQ,8CAA6C;AAE/E,SAASC,oBAAoB,QAAQ,iDAAgD;AAErF,SAASC,kBAAkB,QAAQ,+CAA8C;AAIjF,SAASC,kBAAkB,QAAQ,oDAAmD;AAEtF,SAASC,mBAAmB,QAAQ,sDAAqD;AAEzF,SAASC,iBAAiB,QAAQ,oCAAmC;AACrE,SAASC,eAAe,QAAQ,kCAAiC;AACjE,SAASC,eAAe,QAAQ,kCAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveVersion.d.ts","sourceRoot":"","sources":["../../src/versions/saveVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAC3F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAM/D,KAAK,IAAI,GAAG;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,yBAAyB,CAAA;IACtC,cAAc,EAAE,GAAG,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,qBAAqB,CAAA;IAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,sBAAsB,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,WAAW,oFASrB,IAAI,KAAG,QAAQ,UAAU,
|
|
1
|
+
{"version":3,"file":"saveVersion.d.ts","sourceRoot":"","sources":["../../src/versions/saveVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAC3F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAM/D,KAAK,IAAI,GAAG;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,yBAAyB,CAAA;IACtC,cAAc,EAAE,GAAG,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,qBAAqB,CAAA;IAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,sBAAsB,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,WAAW,oFASrB,IAAI,KAAG,QAAQ,UAAU,CAmI3B,CAAA"}
|
|
@@ -94,6 +94,7 @@ export const saveVersion = async ({ id, autosave, collection, docWithLocales: do
|
|
|
94
94
|
if (global) errorMessage = `There was an error while saving a version for the global ${global.label}.`;
|
|
95
95
|
payload.logger.error(errorMessage);
|
|
96
96
|
payload.logger.error(err);
|
|
97
|
+
return;
|
|
97
98
|
}
|
|
98
99
|
let max = 100;
|
|
99
100
|
if (collection && typeof collection.versions.maxPerDoc === 'number') max = collection.versions.maxPerDoc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/versions/saveVersion.ts"],"sourcesContent":["import type { SanitizedCollectionConfig, TypeWithID } from '../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../globals/config/types.js'\nimport type { Payload } from '../index.js'\nimport type { PayloadRequestWithData } from '../types/index.js'\n\nimport { deepCopyObject } from '../utilities/deepCopyObject.js'\nimport sanitizeInternalFields from '../utilities/sanitizeInternalFields.js'\nimport { enforceMaxVersions } from './enforceMaxVersions.js'\n\ntype Args = {\n autosave?: boolean\n collection?: SanitizedCollectionConfig\n docWithLocales: any\n draft?: boolean\n global?: SanitizedGlobalConfig\n id?: number | string\n payload: Payload\n req?: PayloadRequestWithData\n}\n\nexport const saveVersion = async ({\n id,\n autosave,\n collection,\n docWithLocales: doc,\n draft,\n global,\n payload,\n req,\n}: Args): Promise<TypeWithID> => {\n let result\n let createNewVersion = true\n const now = new Date().toISOString()\n const versionData = deepCopyObject(doc)\n if (draft) versionData._status = 'draft'\n if (versionData._id) delete versionData._id\n\n try {\n if (autosave) {\n let docs\n const findVersionArgs = {\n limit: 1,\n pagination: false,\n req,\n sort: '-updatedAt',\n }\n if (collection) {\n ;({ docs } = await payload.db.findVersions({\n ...findVersionArgs,\n collection: collection.slug,\n req,\n where: {\n parent: {\n equals: id,\n },\n },\n }))\n } else {\n ;({ docs } = await payload.db.findGlobalVersions({\n ...findVersionArgs,\n global: global.slug,\n req,\n }))\n }\n const [latestVersion] = docs\n\n // overwrite the latest version if it's set to autosave\n if (latestVersion?.autosave === true) {\n createNewVersion = false\n\n const data: Record<string, unknown> = {\n createdAt: new Date(latestVersion.createdAt).toISOString(),\n updatedAt: draft ? now : new Date(doc.updatedAt).toISOString(),\n version: versionData,\n }\n\n const updateVersionArgs = {\n id: latestVersion.id,\n req,\n versionData: data as TypeWithID,\n }\n\n if (collection) {\n result = await payload.db.updateVersion({\n ...updateVersionArgs,\n collection: collection.slug,\n req,\n })\n } else {\n result = await payload.db.updateGlobalVersion({\n ...updateVersionArgs,\n global: global.slug,\n req,\n })\n }\n }\n }\n\n if (createNewVersion) {\n if (collection) {\n result = await payload.db.createVersion({\n autosave: Boolean(autosave),\n collectionSlug: collection.slug,\n createdAt: doc?.createdAt ? new Date(doc.createdAt).toISOString() : now,\n parent: collection ? id : undefined,\n req,\n updatedAt: draft ? now : new Date(doc.updatedAt).toISOString(),\n versionData,\n })\n }\n\n if (global) {\n result = await payload.db.createGlobalVersion({\n autosave: Boolean(autosave),\n createdAt: doc?.createdAt ? new Date(doc.createdAt).toISOString() : now,\n globalSlug: global.slug,\n parent: collection ? id : undefined,\n req,\n updatedAt: draft ? now : new Date(doc.updatedAt).toISOString(),\n versionData,\n })\n }\n }\n } catch (err) {\n let errorMessage: string\n\n if (collection)\n errorMessage = `There was an error while saving a version for the ${collection.labels.singular} with ID ${id}.`\n if (global)\n errorMessage = `There was an error while saving a version for the global ${global.label}.`\n payload.logger.error(errorMessage)\n payload.logger.error(err)\n }\n\n let max = 100\n\n if (collection && typeof collection.versions.maxPerDoc === 'number')\n max = collection.versions.maxPerDoc\n if (global && typeof global.versions.max === 'number') max = global.versions.max\n\n if (createNewVersion && max > 0) {\n await enforceMaxVersions({\n id,\n collection,\n global,\n max,\n payload,\n req,\n })\n }\n\n let createdVersion = result.version\n createdVersion.createdAt = result.createdAt\n createdVersion.updatedAt = result.updatedAt\n\n createdVersion = sanitizeInternalFields(createdVersion)\n createdVersion.id = result.parent\n\n return createdVersion\n}\n"],"names":["deepCopyObject","sanitizeInternalFields","enforceMaxVersions","saveVersion","id","autosave","collection","docWithLocales","doc","draft","global","payload","req","result","createNewVersion","now","Date","toISOString","versionData","_status","_id","docs","findVersionArgs","limit","pagination","sort","db","findVersions","slug","where","parent","equals","findGlobalVersions","latestVersion","data","createdAt","updatedAt","version","updateVersionArgs","updateVersion","updateGlobalVersion","createVersion","Boolean","collectionSlug","undefined","createGlobalVersion","globalSlug","err","errorMessage","labels","singular","label","logger","error","max","versions","maxPerDoc","createdVersion"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/versions/saveVersion.ts"],"sourcesContent":["import type { SanitizedCollectionConfig, TypeWithID } from '../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../globals/config/types.js'\nimport type { Payload } from '../index.js'\nimport type { PayloadRequestWithData } from '../types/index.js'\n\nimport { deepCopyObject } from '../utilities/deepCopyObject.js'\nimport sanitizeInternalFields from '../utilities/sanitizeInternalFields.js'\nimport { enforceMaxVersions } from './enforceMaxVersions.js'\n\ntype Args = {\n autosave?: boolean\n collection?: SanitizedCollectionConfig\n docWithLocales: any\n draft?: boolean\n global?: SanitizedGlobalConfig\n id?: number | string\n payload: Payload\n req?: PayloadRequestWithData\n}\n\nexport const saveVersion = async ({\n id,\n autosave,\n collection,\n docWithLocales: doc,\n draft,\n global,\n payload,\n req,\n}: Args): Promise<TypeWithID> => {\n let result\n let createNewVersion = true\n const now = new Date().toISOString()\n const versionData = deepCopyObject(doc)\n if (draft) versionData._status = 'draft'\n if (versionData._id) delete versionData._id\n\n try {\n if (autosave) {\n let docs\n const findVersionArgs = {\n limit: 1,\n pagination: false,\n req,\n sort: '-updatedAt',\n }\n if (collection) {\n ;({ docs } = await payload.db.findVersions({\n ...findVersionArgs,\n collection: collection.slug,\n req,\n where: {\n parent: {\n equals: id,\n },\n },\n }))\n } else {\n ;({ docs } = await payload.db.findGlobalVersions({\n ...findVersionArgs,\n global: global.slug,\n req,\n }))\n }\n const [latestVersion] = docs\n\n // overwrite the latest version if it's set to autosave\n if (latestVersion?.autosave === true) {\n createNewVersion = false\n\n const data: Record<string, unknown> = {\n createdAt: new Date(latestVersion.createdAt).toISOString(),\n updatedAt: draft ? now : new Date(doc.updatedAt).toISOString(),\n version: versionData,\n }\n\n const updateVersionArgs = {\n id: latestVersion.id,\n req,\n versionData: data as TypeWithID,\n }\n\n if (collection) {\n result = await payload.db.updateVersion({\n ...updateVersionArgs,\n collection: collection.slug,\n req,\n })\n } else {\n result = await payload.db.updateGlobalVersion({\n ...updateVersionArgs,\n global: global.slug,\n req,\n })\n }\n }\n }\n\n if (createNewVersion) {\n if (collection) {\n result = await payload.db.createVersion({\n autosave: Boolean(autosave),\n collectionSlug: collection.slug,\n createdAt: doc?.createdAt ? new Date(doc.createdAt).toISOString() : now,\n parent: collection ? id : undefined,\n req,\n updatedAt: draft ? now : new Date(doc.updatedAt).toISOString(),\n versionData,\n })\n }\n\n if (global) {\n result = await payload.db.createGlobalVersion({\n autosave: Boolean(autosave),\n createdAt: doc?.createdAt ? new Date(doc.createdAt).toISOString() : now,\n globalSlug: global.slug,\n parent: collection ? id : undefined,\n req,\n updatedAt: draft ? now : new Date(doc.updatedAt).toISOString(),\n versionData,\n })\n }\n }\n } catch (err) {\n let errorMessage: string\n\n if (collection)\n errorMessage = `There was an error while saving a version for the ${collection.labels.singular} with ID ${id}.`\n if (global)\n errorMessage = `There was an error while saving a version for the global ${global.label}.`\n payload.logger.error(errorMessage)\n payload.logger.error(err)\n return\n }\n\n let max = 100\n\n if (collection && typeof collection.versions.maxPerDoc === 'number')\n max = collection.versions.maxPerDoc\n if (global && typeof global.versions.max === 'number') max = global.versions.max\n\n if (createNewVersion && max > 0) {\n await enforceMaxVersions({\n id,\n collection,\n global,\n max,\n payload,\n req,\n })\n }\n\n let createdVersion = result.version\n createdVersion.createdAt = result.createdAt\n createdVersion.updatedAt = result.updatedAt\n\n createdVersion = sanitizeInternalFields(createdVersion)\n createdVersion.id = result.parent\n\n return createdVersion\n}\n"],"names":["deepCopyObject","sanitizeInternalFields","enforceMaxVersions","saveVersion","id","autosave","collection","docWithLocales","doc","draft","global","payload","req","result","createNewVersion","now","Date","toISOString","versionData","_status","_id","docs","findVersionArgs","limit","pagination","sort","db","findVersions","slug","where","parent","equals","findGlobalVersions","latestVersion","data","createdAt","updatedAt","version","updateVersionArgs","updateVersion","updateGlobalVersion","createVersion","Boolean","collectionSlug","undefined","createGlobalVersion","globalSlug","err","errorMessage","labels","singular","label","logger","error","max","versions","maxPerDoc","createdVersion"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAKA,SAASA,cAAc,QAAQ,iCAAgC;AAC/D,OAAOC,4BAA4B,yCAAwC;AAC3E,SAASC,kBAAkB,QAAQ,0BAAyB;AA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KAAK,CAAC,CAAC,CAAC;QAC5FxC,QAAQyC,MAAM,CAACC,KAAK,CAACL;QACrBrC,QAAQyC,MAAM,CAACC,KAAK,CAACN;QACrB;IACF;IAEA,IAAIO,MAAM;IAEV,IAAIhD,cAAc,OAAOA,WAAWiD,QAAQ,CAACC,SAAS,KAAK,UACzDF,MAAMhD,WAAWiD,QAAQ,CAACC,SAAS;IACrC,IAAI9C,UAAU,OAAOA,OAAO6C,QAAQ,CAACD,GAAG,KAAK,UAAUA,MAAM5C,OAAO6C,QAAQ,CAACD,GAAG;IAEhF,IAAIxC,oBAAoBwC,MAAM,GAAG;QAC/B,MAAMpD,mBAAmB;YACvBE;YACAE;YACAI;YACA4C;YACA3C;YACAC;QACF;IACF;IAEA,IAAI6C,iBAAiB5C,OAAOwB,OAAO;IACnCoB,eAAetB,SAAS,GAAGtB,OAAOsB,SAAS;IAC3CsB,eAAerB,SAAS,GAAGvB,OAAOuB,SAAS;IAE3CqB,iBAAiBxD,uBAAuBwD;IACxCA,eAAerD,EAAE,GAAGS,OAAOiB,MAAM;IAEjC,OAAO2B;AACT,EAAC"}
|
package/errors.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { APIError, AuthenticationError, DuplicateCollection, DuplicateGlobal, ErrorDeletingFile, FileUploadError, Forbidden, InvalidConfiguration, InvalidFieldName, InvalidFieldRelationship, LockedAuth, MissingCollectionLabel, MissingFieldInputOptions, MissingFieldType, MissingFile, NotFound, QueryError, ValidationError, } from './dist/errors/index.js';
|
|
2
|
+
//# sourceMappingURL=errors.d.ts.map
|
package/errors.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { APIError, AuthenticationError, DuplicateCollection, DuplicateGlobal, ErrorDeletingFile, FileUploadError, Forbidden, InvalidConfiguration, InvalidFieldName, InvalidFieldRelationship, LockedAuth, MissingCollectionLabel, MissingFieldInputOptions, MissingFieldType, MissingFile, NotFound, QueryError, ValidationError } from './dist/errors/index.js';
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=errors.js.map
|
package/graphql.d.ts
ADDED
package/graphql.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
GraphQL: function() {
|
|
13
|
+
return _graphql.default;
|
|
14
|
+
},
|
|
15
|
+
buildPaginatedListType: function() {
|
|
16
|
+
return _buildPaginatedListType.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _buildPaginatedListType = /*#__PURE__*/ _interop_require_default(require("./dist/graphql/schema/buildPaginatedListType"));
|
|
20
|
+
const _graphql = /*#__PURE__*/ _interop_require_default(require("graphql"));
|
|
21
|
+
function _interop_require_default(obj) {
|
|
22
|
+
return obj && obj.__esModule ? obj : {
|
|
23
|
+
default: obj
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leHBvcnRzL2dyYXBocWwudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZGVmYXVsdCBhcyBidWlsZFBhZ2luYXRlZExpc3RUeXBlIH0gZnJvbSAnLi8uLi9ncmFwaHFsL3NjaGVtYS9idWlsZFBhZ2luYXRlZExpc3RUeXBlJ1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBHcmFwaFFMIH0gZnJvbSAnZ3JhcGhxbCdcbiJdLCJuYW1lcyI6WyJHcmFwaFFMIiwiYnVpbGRQYWdpbmF0ZWRMaXN0VHlwZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7SUFDb0JBLE9BQU87ZUFBUEEsZ0JBQU87O0lBRFBDLHNCQUFzQjtlQUF0QkEsK0JBQXNCOzs7K0VBQVE7Z0VBQ2YifQ==
|
package/operations.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { accessOperation } from './dist/auth/operations/access.js';
|
|
2
|
+
export { forgotPasswordOperation } from './dist/auth/operations/forgotPassword.js';
|
|
3
|
+
export { initOperation } from './dist/auth/operations/init.js';
|
|
4
|
+
export { loginOperation } from './dist/auth/operations/login.js';
|
|
5
|
+
export { logoutOperation } from './dist/auth/operations/logout.js';
|
|
6
|
+
export { meOperation } from './dist/auth/operations/me.js';
|
|
7
|
+
export { refreshOperation } from './dist/auth/operations/refresh.js';
|
|
8
|
+
export { registerFirstUserOperation } from './dist/auth/operations/registerFirstUser.js';
|
|
9
|
+
export { resetPasswordOperation } from './dist/auth/operations/resetPassword.js';
|
|
10
|
+
export { unlockOperation } from './dist/auth/operations/unlock.js';
|
|
11
|
+
export { verifyEmailOperation } from './dist/auth/operations/verifyEmail.js';
|
|
12
|
+
export { createOperation } from './dist/collections/operations/create.js';
|
|
13
|
+
export { deleteOperation } from './dist/collections/operations/delete.js';
|
|
14
|
+
export { deleteByIDOperation } from './dist/collections/operations/deleteByID.js';
|
|
15
|
+
export { docAccessOperation } from './dist/collections/operations/docAccess.js';
|
|
16
|
+
export { duplicateOperation } from './dist/collections/operations/duplicate.js';
|
|
17
|
+
export { findOperation } from './dist/collections/operations/find.js';
|
|
18
|
+
export { findByIDOperation } from './dist/collections/operations/findByID.js';
|
|
19
|
+
export { findVersionByIDOperation } from './dist/collections/operations/findVersionByID.js';
|
|
20
|
+
export { findVersionsOperation } from './dist/collections/operations/findVersions.js';
|
|
21
|
+
export { restoreVersionOperation } from './dist/collections/operations/restoreVersion.js';
|
|
22
|
+
export { updateOperation } from './dist/collections/operations/update.js';
|
|
23
|
+
export { updateByIDOperation } from './dist/collections/operations/updateByID.js';
|
|
24
|
+
export { docAccessOperation as docAccessOperationGlobal } from './dist/globals/operations/docAccess.js';
|
|
25
|
+
export { findOneOperation } from './dist/globals/operations/findOne.js';
|
|
26
|
+
export { findVersionByIDOperation as findVersionByIDOperationGlobal } from './dist/globals/operations/findVersionByID.js';
|
|
27
|
+
export { findVersionsOperation as findVersionsOperationGlobal } from './dist/globals/operations/findVersions.js';
|
|
28
|
+
export { restoreVersionOperation as restoreVersionOperationGlobal } from './dist/globals/operations/restoreVersion.js';
|
|
29
|
+
export { updateOperation as updateOperationGlobal } from './dist/globals/operations/update.js';
|
|
30
|
+
//# sourceMappingURL=operations.d.ts.map
|
package/operations.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export { accessOperation } from './dist/auth/operations/access.js';
|
|
2
|
+
export { forgotPasswordOperation } from './dist/auth/operations/forgotPassword.js';
|
|
3
|
+
export { initOperation } from './dist/auth/operations/init.js';
|
|
4
|
+
export { loginOperation } from './dist/auth/operations/login.js';
|
|
5
|
+
export { logoutOperation } from './dist/auth/operations/logout.js';
|
|
6
|
+
export { meOperation } from './dist/auth/operations/me.js';
|
|
7
|
+
export { refreshOperation } from './dist/auth/operations/refresh.js';
|
|
8
|
+
export { registerFirstUserOperation } from './dist/auth/operations/registerFirstUser.js';
|
|
9
|
+
export { resetPasswordOperation } from './dist/auth/operations/resetPassword.js';
|
|
10
|
+
export { unlockOperation } from './dist/auth/operations/unlock.js';
|
|
11
|
+
export { verifyEmailOperation } from './dist/auth/operations/verifyEmail.js';
|
|
12
|
+
export { createOperation } from './dist/collections/operations/create.js';
|
|
13
|
+
export { deleteOperation } from './dist/collections/operations/delete.js';
|
|
14
|
+
export { deleteByIDOperation } from './dist/collections/operations/deleteByID.js';
|
|
15
|
+
export { docAccessOperation } from './dist/collections/operations/docAccess.js';
|
|
16
|
+
export { duplicateOperation } from './dist/collections/operations/duplicate.js';
|
|
17
|
+
export { findOperation } from './dist/collections/operations/find.js';
|
|
18
|
+
export { findByIDOperation } from './dist/collections/operations/findByID.js';
|
|
19
|
+
export { findVersionByIDOperation } from './dist/collections/operations/findVersionByID.js';
|
|
20
|
+
export { findVersionsOperation } from './dist/collections/operations/findVersions.js';
|
|
21
|
+
export { restoreVersionOperation } from './dist/collections/operations/restoreVersion.js';
|
|
22
|
+
export { updateOperation } from './dist/collections/operations/update.js';
|
|
23
|
+
export { updateByIDOperation } from './dist/collections/operations/updateByID.js';
|
|
24
|
+
export { docAccessOperation as docAccessOperationGlobal } from './dist/globals/operations/docAccess.js';
|
|
25
|
+
export { findOneOperation } from './dist/globals/operations/findOne.js';
|
|
26
|
+
export { findVersionByIDOperation as findVersionByIDOperationGlobal } from './dist/globals/operations/findVersionByID.js';
|
|
27
|
+
export { findVersionsOperation as findVersionsOperationGlobal } from './dist/globals/operations/findVersions.js';
|
|
28
|
+
export { restoreVersionOperation as restoreVersionOperationGlobal } from './dist/globals/operations/restoreVersion.js';
|
|
29
|
+
export { updateOperation as updateOperationGlobal } from './dist/globals/operations/update.js';
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=operations.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.39",
|
|
4
4
|
"description": "Node, React, Headless CMS and Application Framework built on Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"admin panel",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"scmp": "2.1.0",
|
|
96
96
|
"ts-essentials": "7.0.3",
|
|
97
97
|
"uuid": "^9.0.1",
|
|
98
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
98
|
+
"@payloadcms/translations": "3.0.0-beta.39"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@monaco-editor/react": "4.5.1",
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './dist/types/index.js';
|
|
2
|
+
export type * from './dist/admin/types.js';
|
|
3
|
+
export type * from './dist/uploads/types.js';
|
|
4
|
+
export type { DocumentPermissions, FieldPermissions } from './dist/auth/index.js';
|
|
5
|
+
export type { MeOperationResult } from './dist/auth/operations/me.js';
|
|
6
|
+
export type { CollapsedPreferences, DocumentPreferences, FieldsPreferences, InsideFieldsPreferences, PreferenceRequest, PreferenceUpdateRequest, TabsPreferences, } from './dist/preferences/types.js';
|
|
7
|
+
export type { ClientCollectionConfig } from './dist/collections/config/client.js';
|
|
8
|
+
export type { AfterChangeHook as CollectionAfterChangeHook, AfterDeleteHook as CollectionAfterDeleteHook, AfterErrorHook as CollectionAfterErrorHook, AfterForgotPasswordHook as CollectionAfterForgotPasswordHook, AfterLoginHook as CollectionAfterLoginHook, AfterOperationHook as CollectionAfterOperationHook, AfterReadHook as CollectionAfterReadHook, BeforeChangeHook as CollectionBeforeChangeHook, BeforeDeleteHook as CollectionBeforeDeleteHook, BeforeLoginHook as CollectionBeforeLoginHook, BeforeOperationHook as CollectionBeforeOperationHook, BeforeReadHook as CollectionBeforeReadHook, BeforeValidateHook as CollectionBeforeValidateHook, Collection, CollectionConfig, SanitizedCollectionConfig, TypeWithID, TypeWithTimestamps, } from './dist/collections/config/types.js';
|
|
9
|
+
export type { ClientConfig } from './dist/config/client.js';
|
|
10
|
+
export type { Access, AccessArgs, EditViewComponent, EntityDescription, EntityDescriptionComponent, EntityDescriptionFunction, SanitizedConfig, } from './dist/config/types.js';
|
|
11
|
+
export type { ClientFieldConfig } from './dist/fields/config/client.js';
|
|
12
|
+
export type { ArrayField, Block, BlockField, CheckboxField, ClientValidate, CodeField, CollapsibleField, Condition, DateField, EmailField, Field, FieldAccess, FieldAffectingData, FieldBase, FieldHook, FieldHookArgs, FieldPresentationalOnly, FieldWithMany, FieldWithMaxDepth, FieldWithPath, FieldWithRichTextRequiredEditor, FieldWithSubFields, FilterOptions, FilterOptionsProps, GroupField, HookName, JSONField, Labels, NamedTab, NonPresentationalField, NumberField, Option, OptionObject, PointField, PolymorphicRelationshipField, RadioField, RelationshipField, RelationshipValue, RichTextField, RichTextFieldRequiredEditor, RowAdmin, RowField, SelectField, SingleRelationshipField, Tab, TabAsField, TabsAdmin, TabsField, TextField, TextareaField, UIField, UnnamedTab, UploadField, Validate, ValidateOptions, ValueWithRelation, } from './dist/fields/config/types.js';
|
|
13
|
+
export { fieldAffectsData, fieldHasMaxDepth, fieldHasSubFields, fieldIsArrayType, fieldIsBlockType, fieldIsGroupType, fieldIsLocalized, fieldIsPresentationalOnly, fieldSupportsMany, optionIsObject, optionIsValue, optionsAreObjects, tabHasName, valueIsValueWithRelation, } from './dist/fields/config/types.js';
|
|
14
|
+
export type { ClientGlobalConfig } from './dist/globals/config/client.js';
|
|
15
|
+
export type { AfterChangeHook as GlobalAfterChangeHook, AfterReadHook as GlobalAfterReadHook, BeforeChangeHook as GlobalBeforeChangeHook, BeforeReadHook as GlobalBeforeReadHook, BeforeValidateHook as GlobalBeforeValidateHook, GlobalConfig, SanitizedGlobalConfig, } from './dist/globals/config/types.js';
|
|
16
|
+
export { validOperators } from './dist/types/constants.js';
|
|
17
|
+
//# sourceMappingURL=types.d.ts.map
|
package/types.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './dist/types/index.js';
|
|
2
|
+
export { fieldAffectsData, fieldHasMaxDepth, fieldHasSubFields, fieldIsArrayType, fieldIsBlockType, fieldIsGroupType, fieldIsLocalized, fieldIsPresentationalOnly, fieldSupportsMany, optionIsObject, optionIsValue, optionsAreObjects, tabHasName, valueIsValueWithRelation } from './dist/fields/config/types.js';
|
|
3
|
+
export { validOperators } from './dist/types/constants.js';
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=types.js.map
|
package/utilities.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { getDataLoader } from './dist/collections/dataloader.js';
|
|
2
|
+
export { default as getDefaultValue } from './dist/fields/getDefaultValue.js';
|
|
3
|
+
export { promise as afterReadPromise } from './dist/fields/hooks/afterRead/promise.js';
|
|
4
|
+
export { traverseFields as afterReadTraverseFields } from './dist/fields/hooks/afterRead/traverseFields.js';
|
|
5
|
+
export { extractTranslations } from './dist/translations/extractTranslations.js';
|
|
6
|
+
export { formatFilesize } from './dist/uploads/formatFilesize.js';
|
|
7
|
+
export { default as isImage } from './dist/uploads/isImage.js';
|
|
8
|
+
export { combineMerge } from './dist/utilities/combineMerge.js';
|
|
9
|
+
export { configToJSONSchema, entityToJSONSchema, fieldsToJSONSchema, withNullableJSONSchemaType, } from './dist/utilities/configToJSONSchema.js';
|
|
10
|
+
export { createArrayFromCommaDelineated } from './dist/utilities/createArrayFromCommaDelineated.js';
|
|
11
|
+
export { createLocalReq } from './dist/utilities/createLocalReq.js';
|
|
12
|
+
export { deepCopyObject } from './dist/utilities/deepCopyObject.js';
|
|
13
|
+
export { deepMerge } from './dist/utilities/deepMerge.js';
|
|
14
|
+
export { fieldSchemaToJSON } from './dist/utilities/fieldSchemaToJSON.js';
|
|
15
|
+
export { default as flattenTopLevelFields } from './dist/utilities/flattenTopLevelFields.js';
|
|
16
|
+
export { formatLabels, formatNames, toWords } from './dist/utilities/formatLabels.js';
|
|
17
|
+
export { getCollectionIDFieldTypes } from './dist/utilities/getCollectionIDFieldTypes.js';
|
|
18
|
+
export { getIDType } from './dist/utilities/getIDType.js';
|
|
19
|
+
export { getObjectDotNotation } from './dist/utilities/getObjectDotNotation.js';
|
|
20
|
+
export { default as getUniqueListBy } from './dist/utilities/getUniqueListBy.js';
|
|
21
|
+
export { isEntityHidden } from './dist/utilities/isEntityHidden.js';
|
|
22
|
+
export { isNumber } from './dist/utilities/isNumber.js';
|
|
23
|
+
export { isPlainObject } from './dist/utilities/isPlainObject.js';
|
|
24
|
+
export { isPlainFunction, isReactComponent } from './dist/utilities/isReactComponent.js';
|
|
25
|
+
export { isValidID } from './dist/utilities/isValidID.js';
|
|
26
|
+
export { default as isolateObjectProperty } from './dist/utilities/isolateObjectProperty.js';
|
|
27
|
+
export { mapAsync } from './dist/utilities/mapAsync.js';
|
|
28
|
+
export { mergeListSearchAndWhere } from './dist/utilities/mergeListSearchAndWhere.js';
|
|
29
|
+
export { setsAreEqual } from './dist/utilities/setsAreEqual.js';
|
|
30
|
+
export { default as toKebabCase } from './dist/utilities/toKebabCase.js';
|
|
31
|
+
export { wait } from './dist/utilities/wait.js';
|
|
32
|
+
export { default as wordBoundariesRegex } from './dist/utilities/wordBoundariesRegex.js';
|
|
33
|
+
//# sourceMappingURL=utilities.d.ts.map
|
package/utilities.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { getDataLoader } from './dist/collections/dataloader.js';
|
|
2
|
+
export { default as getDefaultValue } from './dist/fields/getDefaultValue.js';
|
|
3
|
+
export { promise as afterReadPromise } from './dist/fields/hooks/afterRead/promise.js';
|
|
4
|
+
export { traverseFields as afterReadTraverseFields } from './dist/fields/hooks/afterRead/traverseFields.js';
|
|
5
|
+
export { extractTranslations } from './dist/translations/extractTranslations.js';
|
|
6
|
+
export { formatFilesize } from './dist/uploads/formatFilesize.js';
|
|
7
|
+
export { default as isImage } from './dist/uploads/isImage.js';
|
|
8
|
+
export { combineMerge } from './dist/utilities/combineMerge.js';
|
|
9
|
+
export { configToJSONSchema, entityToJSONSchema, fieldsToJSONSchema, withNullableJSONSchemaType } from './dist/utilities/configToJSONSchema.js';
|
|
10
|
+
export { createArrayFromCommaDelineated } from './dist/utilities/createArrayFromCommaDelineated.js';
|
|
11
|
+
export { createLocalReq } from './dist/utilities/createLocalReq.js';
|
|
12
|
+
export { deepCopyObject } from './dist/utilities/deepCopyObject.js';
|
|
13
|
+
export { deepMerge } from './dist/utilities/deepMerge.js';
|
|
14
|
+
export { fieldSchemaToJSON } from './dist/utilities/fieldSchemaToJSON.js';
|
|
15
|
+
export { default as flattenTopLevelFields } from './dist/utilities/flattenTopLevelFields.js';
|
|
16
|
+
export { formatLabels, formatNames, toWords } from './dist/utilities/formatLabels.js';
|
|
17
|
+
export { getCollectionIDFieldTypes } from './dist/utilities/getCollectionIDFieldTypes.js';
|
|
18
|
+
export { getIDType } from './dist/utilities/getIDType.js';
|
|
19
|
+
export { getObjectDotNotation } from './dist/utilities/getObjectDotNotation.js';
|
|
20
|
+
export { default as getUniqueListBy } from './dist/utilities/getUniqueListBy.js';
|
|
21
|
+
export { isEntityHidden } from './dist/utilities/isEntityHidden.js';
|
|
22
|
+
export { isNumber } from './dist/utilities/isNumber.js';
|
|
23
|
+
export { isPlainObject } from './dist/utilities/isPlainObject.js';
|
|
24
|
+
export { isPlainFunction, isReactComponent } from './dist/utilities/isReactComponent.js';
|
|
25
|
+
export { isValidID } from './dist/utilities/isValidID.js';
|
|
26
|
+
export { default as isolateObjectProperty } from './dist/utilities/isolateObjectProperty.js';
|
|
27
|
+
export { mapAsync } from './dist/utilities/mapAsync.js';
|
|
28
|
+
export { mergeListSearchAndWhere } from './dist/utilities/mergeListSearchAndWhere.js';
|
|
29
|
+
export { setsAreEqual } from './dist/utilities/setsAreEqual.js';
|
|
30
|
+
export { default as toKebabCase } from './dist/utilities/toKebabCase.js';
|
|
31
|
+
export { wait } from './dist/utilities/wait.js';
|
|
32
|
+
export { default as wordBoundariesRegex } from './dist/utilities/wordBoundariesRegex.js';
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=utilities.js.map
|
package/versions.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { buildVersionCollectionFields } from './dist/versions/buildCollectionFields.js';
|
|
2
|
+
export { buildVersionGlobalFields } from './dist/versions/buildGlobalFields.js';
|
|
3
|
+
export { deleteCollectionVersions } from './dist/versions/deleteCollectionVersions.js';
|
|
4
|
+
export { enforceMaxVersions } from './dist/versions/enforceMaxVersions.js';
|
|
5
|
+
export { getLatestCollectionVersion } from './dist/versions/getLatestCollectionVersion.js';
|
|
6
|
+
export { getLatestGlobalVersion } from './dist/versions/getLatestGlobalVersion.js';
|
|
7
|
+
export { saveVersion } from './dist/versions/saveVersion.js';
|
|
8
|
+
export type { TypeWithVersion } from './dist/versions/types.js';
|
|
9
|
+
//# sourceMappingURL=versions.d.ts.map
|
package/versions.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { buildVersionCollectionFields } from './dist/versions/buildCollectionFields.js';
|
|
2
|
+
export { buildVersionGlobalFields } from './dist/versions/buildGlobalFields.js';
|
|
3
|
+
export { deleteCollectionVersions } from './dist/versions/deleteCollectionVersions.js';
|
|
4
|
+
export { enforceMaxVersions } from './dist/versions/enforceMaxVersions.js';
|
|
5
|
+
export { getLatestCollectionVersion } from './dist/versions/getLatestCollectionVersion.js';
|
|
6
|
+
export { getLatestGlobalVersion } from './dist/versions/getLatestGlobalVersion.js';
|
|
7
|
+
export { saveVersion } from './dist/versions/saveVersion.js';
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=versions.js.map
|