payload-plugin-urls 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +357 -36
- package/dist/field.d.ts +2 -9
- package/dist/field.d.ts.map +1 -1
- package/dist/hooks.d.ts +5 -4
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +18 -3
- package/dist/options.d.ts.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/resolver.d.ts.map +1 -1
- package/dist/types.d.ts +44 -84
- package/dist/types.d.ts.map +1 -1
- package/dist/update-urls.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/resolver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAIV,uBAAuB,EAIxB,MAAM,SAAS,CAAA;AAEhB,wBAAsB,mBAAmB,CAAC,EACxC,UAAU,EACV,IAAI,EACJ,MAAM,EACN,OAAO,EACP,WAAW,EACX,OAAO,EACP,SAAS,GACV,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA6EvD"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,34 +1,45 @@
|
|
|
1
|
+
import type { CollectionAfterChangeHook, CollectionBeforeChangeHook, CollectionConfig, Field, GlobalAfterChangeHook, GlobalConfig, LabelFunction, Payload, Plugin, StaticLabel, WorkflowConfig } from "payload";
|
|
1
2
|
export type Locale = string;
|
|
2
3
|
export type UrlPrefixStrategy = "category" | "rootPage";
|
|
3
|
-
export
|
|
4
|
+
export interface Breadcrumb {
|
|
4
5
|
url?: string | null;
|
|
5
|
-
}
|
|
6
|
-
export
|
|
7
|
-
id?: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface UrlDoc {
|
|
8
|
+
id?: string | number | null;
|
|
8
9
|
slug?: string | null;
|
|
9
10
|
populatedUrl?: string | null;
|
|
10
11
|
breadcrumbs?: Breadcrumb[] | null;
|
|
11
12
|
categories?: unknown;
|
|
12
13
|
_status?: "draft" | "published" | null;
|
|
13
14
|
[key: string]: unknown;
|
|
14
|
-
}
|
|
15
|
-
export
|
|
15
|
+
}
|
|
16
|
+
export interface RootPagesDoc {
|
|
16
17
|
id?: string | null;
|
|
17
18
|
[field: string]: string | UrlDoc | null | undefined;
|
|
18
|
-
}
|
|
19
|
-
export
|
|
20
|
-
slug: string;
|
|
19
|
+
}
|
|
20
|
+
export interface UrlCollectionOptions {
|
|
21
21
|
breadcrumbs?: boolean;
|
|
22
|
-
|
|
22
|
+
prefixStrategy?: UrlPrefixStrategy;
|
|
23
|
+
rootPage?: string;
|
|
23
24
|
category?: {
|
|
24
25
|
collection: string;
|
|
25
26
|
field?: string;
|
|
26
|
-
prefixStrategy?: UrlPrefixStrategy;
|
|
27
27
|
};
|
|
28
28
|
routeCollection?: string;
|
|
29
|
-
}
|
|
30
|
-
export
|
|
31
|
-
|
|
29
|
+
}
|
|
30
|
+
export interface RootPageFieldOptions {
|
|
31
|
+
isHomepage?: boolean;
|
|
32
|
+
relationTo?: string;
|
|
33
|
+
overrides?: Partial<Field>;
|
|
34
|
+
}
|
|
35
|
+
export interface PayloadPluginUrlsOptions {
|
|
36
|
+
collections: Record<string, UrlCollectionOptions>;
|
|
37
|
+
/**
|
|
38
|
+
* Merged into the root-pages global after plugin defaults. Hook arrays are concatenated
|
|
39
|
+
* (plugin hooks first, then yours). `fields` is ignored; use `rootPages.fields[field].overrides`
|
|
40
|
+
* for relationship field tweaks.
|
|
41
|
+
*/
|
|
42
|
+
overrides?: Partial<GlobalConfig>;
|
|
32
43
|
field?: {
|
|
33
44
|
name?: string;
|
|
34
45
|
overrides?: Record<string, unknown>;
|
|
@@ -39,29 +50,12 @@ export type PayloadPluginUrlsOptions = {
|
|
|
39
50
|
};
|
|
40
51
|
rootPages?: {
|
|
41
52
|
slug?: string;
|
|
42
|
-
label?:
|
|
43
|
-
|
|
44
|
-
fieldLabels?: Record<string, unknown>;
|
|
45
|
-
fieldOverrides?: Record<string, Partial<FieldLike>>;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export type PayloadLike = {
|
|
49
|
-
find?: (args: Record<string, unknown>) => Promise<{
|
|
50
|
-
docs: UrlDoc[];
|
|
51
|
-
nextPage?: number | null;
|
|
52
|
-
}>;
|
|
53
|
-
findByID?: (args: Record<string, unknown>) => Promise<UrlDoc>;
|
|
54
|
-
findGlobal?: (args: Record<string, unknown>) => Promise<RootPagesDoc>;
|
|
55
|
-
jobs?: {
|
|
56
|
-
queue?: (args: Record<string, unknown>) => Promise<unknown>;
|
|
57
|
-
run?: (args: Record<string, unknown>) => Promise<unknown>;
|
|
53
|
+
label?: LabelFunction | StaticLabel;
|
|
54
|
+
fields?: Record<string, RootPageFieldOptions>;
|
|
58
55
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
update?: (args: Record<string, unknown>) => Promise<unknown>;
|
|
63
|
-
};
|
|
64
|
-
export type HookArgs = {
|
|
56
|
+
}
|
|
57
|
+
export type PayloadLike = Payload;
|
|
58
|
+
export interface HookArgs {
|
|
65
59
|
collection?: {
|
|
66
60
|
slug?: string;
|
|
67
61
|
};
|
|
@@ -75,49 +69,15 @@ export type HookArgs = {
|
|
|
75
69
|
context?: Record<string, unknown>;
|
|
76
70
|
payload: PayloadLike;
|
|
77
71
|
};
|
|
78
|
-
}
|
|
79
|
-
export type Hook =
|
|
80
|
-
export type PayloadPluginConfig =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
[key: string]: unknown;
|
|
88
|
-
};
|
|
89
|
-
export type CollectionConfigLike = {
|
|
90
|
-
slug: string;
|
|
91
|
-
fields: FieldLike[];
|
|
92
|
-
defaultPopulate?: Record<string, unknown>;
|
|
93
|
-
hooks?: {
|
|
94
|
-
beforeChange?: Hook[];
|
|
95
|
-
afterChange?: Hook[];
|
|
96
|
-
[key: string]: unknown;
|
|
97
|
-
};
|
|
98
|
-
[key: string]: unknown;
|
|
99
|
-
};
|
|
100
|
-
export type GlobalConfigLike = {
|
|
101
|
-
slug: string;
|
|
102
|
-
fields: FieldLike[];
|
|
103
|
-
hooks?: {
|
|
104
|
-
afterChange?: Hook[];
|
|
105
|
-
[key: string]: unknown;
|
|
106
|
-
};
|
|
107
|
-
[key: string]: unknown;
|
|
108
|
-
};
|
|
109
|
-
export type FieldLike = {
|
|
110
|
-
name?: string;
|
|
111
|
-
type?: string;
|
|
112
|
-
[key: string]: unknown;
|
|
113
|
-
};
|
|
114
|
-
export type WorkflowLike = {
|
|
115
|
-
slug?: string;
|
|
116
|
-
handler?: unknown;
|
|
117
|
-
[key: string]: unknown;
|
|
118
|
-
};
|
|
119
|
-
export type PayloadPlugin = (config: PayloadPluginConfig) => PayloadPluginConfig;
|
|
120
|
-
export type ResolvePopulatedUrlArgs = {
|
|
72
|
+
}
|
|
73
|
+
export type Hook = CollectionBeforeChangeHook | CollectionAfterChangeHook | GlobalAfterChangeHook;
|
|
74
|
+
export type PayloadPluginConfig = Parameters<Plugin>[0];
|
|
75
|
+
export type CollectionConfigLike = CollectionConfig;
|
|
76
|
+
export type GlobalConfigLike = GlobalConfig;
|
|
77
|
+
export type FieldLike = Field;
|
|
78
|
+
export type WorkflowLike = WorkflowConfig;
|
|
79
|
+
export type PayloadPlugin = Plugin;
|
|
80
|
+
export interface ResolvePopulatedUrlArgs {
|
|
121
81
|
collection: string;
|
|
122
82
|
data: Partial<UrlDoc>;
|
|
123
83
|
locale: Locale;
|
|
@@ -125,17 +85,17 @@ export type ResolvePopulatedUrlArgs = {
|
|
|
125
85
|
originalDoc?: Partial<UrlDoc>;
|
|
126
86
|
payload?: PayloadLike;
|
|
127
87
|
rootPages: RootPagesDoc;
|
|
128
|
-
}
|
|
129
|
-
export
|
|
88
|
+
}
|
|
89
|
+
export interface GetDocumentLinkArgs {
|
|
130
90
|
relationTo: string;
|
|
131
91
|
value: string | UrlDoc;
|
|
132
|
-
}
|
|
133
|
-
export
|
|
92
|
+
}
|
|
93
|
+
export interface GetDocumentLinkContext {
|
|
134
94
|
baseUrl?: string;
|
|
135
95
|
locale: Locale;
|
|
136
96
|
options: PayloadPluginUrlsOptions;
|
|
137
97
|
urlPrefixStrategy?: UrlPrefixStrategy;
|
|
138
|
-
}
|
|
98
|
+
}
|
|
139
99
|
export type UrlUpdateSource = {
|
|
140
100
|
collection: string;
|
|
141
101
|
id?: string | null;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAE3B,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,UAAU,CAAA;AAEvD,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,gBAAgB,EAChB,KAAK,EACL,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,OAAO,EACP,MAAM,EACN,WAAW,EACX,cAAc,EACf,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAE3B,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,UAAU,CAAA;AAEvD,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB;AAED,MAAM,WA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AAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,wBAAwB,CAAA;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IAC7B,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,SAAS,EAAE,YAAY,CAAA;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,wBAAwB,CAAA;IACjC,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;CACtC;AAED,MAAM,MAAM,eAAe,GACvB;IACE,UAAU,EAAE,MAAM,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAA;CACzC,GACD;IACE,OAAO,EAAE,YAAY,CAAA;IACrB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,IAAI,EAAE,WAAW,CAAA;CAClB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-urls.d.ts","sourceRoot":"","sources":["../src/update-urls.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-urls.d.ts","sourceRoot":"","sources":["../src/update-urls.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAEV,WAAW,EACX,wBAAwB,EACxB,YAAY,EACZ,MAAM,EACN,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,IACzD,eAGX;IACD,GAAG,EAAE;QACH,KAAK,CAAC,EAAE;YACN,OAAO,CAAC,EAAE,eAAe,EAAE,GAAG,IAAI,CAAA;SACnC,CAAA;KACF,CAAA;IACD,GAAG,EAAE;QACH,OAAO,EAAE,WAAW,CAAA;KACrB,CAAA;CACF,mBAqDF;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,WASnE;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,YAAY,GAAG,SAAS,EAClC,OAAO,EAAE,wBAAwB,GAChC,eAAe,EAAE,CA+BnB;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,EAAE,wBAAwB,gBASlC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload-plugin-urls",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Payload CMS plugin for URL utilities.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"typecheck": "tsc --noEmit"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"payload": "
|
|
44
|
+
"payload": "^3.80.0"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|