rimecms 0.31.2 → 0.31.3

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.
@@ -76,7 +76,7 @@ declare class CollectionAPI<Doc extends RegisterCollection[CollectionSlug]> {
76
76
  * limit: 10
77
77
  * });
78
78
  */
79
- find(args: APIMethodArgs<typeof find>): Promise<Doc[]>;
79
+ find(args?: APIMethodArgs<typeof find>): Promise<Doc[]>;
80
80
  /**
81
81
  * Finds a document in the collection by ID
82
82
  *
@@ -148,7 +148,8 @@ declare class CollectionAPI<Doc extends RegisterCollection[CollectionSlug]> {
148
148
  */
149
149
  deleteById: ({ id }: APIMethodArgs<typeof deleteById>) => Promise<string>;
150
150
  /**
151
- * Deletes multiple documents in the collection
151
+ * Deletes multiple documents in the collection. No query means no filter —
152
+ * `delete()` with no args deletes every document in the collection.
152
153
  *
153
154
  * @example
154
155
  * const posts = await rime.collection('posts').delete({
@@ -156,7 +157,7 @@ declare class CollectionAPI<Doc extends RegisterCollection[CollectionSlug]> {
156
157
  * limit: 10
157
158
  * });
158
159
  */
159
- delete: (args: APIMethodArgs<typeof deleteDocs>) => Promise<string[]>;
160
+ delete: (args?: APIMethodArgs<typeof deleteDocs>) => Promise<string[]>;
160
161
  }
161
162
  export { CollectionAPI };
162
163
  /****************************************************
@@ -132,7 +132,7 @@ class CollectionAPI {
132
132
  * limit: 10
133
133
  * });
134
134
  */
135
- find(args) {
135
+ find(args = {}) {
136
136
  const { query, locale, sort = '-updatedAt', depth = 0, limit, offset, draft } = args;
137
137
  const params = {
138
138
  select: args.select,
@@ -282,7 +282,8 @@ class CollectionAPI {
282
282
  });
283
283
  };
284
284
  /**
285
- * Deletes multiple documents in the collection
285
+ * Deletes multiple documents in the collection. No query means no filter —
286
+ * `delete()` with no args deletes every document in the collection.
286
287
  *
287
288
  * @example
288
289
  * const posts = await rime.collection('posts').delete({
@@ -290,7 +291,7 @@ class CollectionAPI {
290
291
  * limit: 10
291
292
  * });
292
293
  */
293
- delete = (args) => {
294
+ delete = (args = {}) => {
294
295
  return deleteDocs({
295
296
  config: this.config,
296
297
  event: this.#event,
@@ -15,7 +15,9 @@ export declare const augmentPanelAccess: <const T extends {
15
15
  };
16
16
  components?: {
17
17
  header?: import("svelte").Component[];
18
- collectionHeader?: import("svelte").Component[];
18
+ collectionHeader?: import("svelte").Component<{
19
+ config: import("../../../types.js").BuiltCollectionClient;
20
+ }>[];
19
21
  dashboard?: import("svelte").Component<{
20
22
  entries: import("../../../panel/pages/dashboard/types").DashboardEntry[];
21
23
  user?: User;
@@ -53,7 +53,9 @@ declare function augmentConfig<T extends Config>(config: T): T & {
53
53
  };
54
54
  components?: {
55
55
  header?: import("svelte").Component[];
56
- collectionHeader?: import("svelte").Component[];
56
+ collectionHeader?: import("svelte").Component<{
57
+ config: import("../types.js").BuiltCollectionClient;
58
+ }>[];
57
59
  dashboard?: import("svelte").Component<{
58
60
  entries: import("../../../panel/pages/dashboard/types.js").DashboardEntry[];
59
61
  user?: import("../../../types.js").User;
@@ -120,7 +120,9 @@ export type PanelConfig = {
120
120
  /** Dashboard header */
121
121
  header?: Component[];
122
122
  /** Collection header */
123
- collectionHeader?: Component[];
123
+ collectionHeader?: Component<{
124
+ config: BuiltCollectionClient;
125
+ }>[];
124
126
  /** Full dashboard component */
125
127
  dashboard?: Component<{
126
128
  entries: DashboardEntry[];
@@ -350,7 +352,9 @@ export type BuiltConfig = {
350
352
  $access: (user?: User) => boolean;
351
353
  components: {
352
354
  header: Component[];
353
- collectionHeader?: Component[];
355
+ collectionHeader?: Component<{
356
+ config: BuiltCollectionClient;
357
+ }>[];
354
358
  dashboard?: Component<{
355
359
  entries: DashboardEntry[];
356
360
  user?: User;
@@ -382,7 +386,9 @@ export type BuiltConfigClient = Omit<BuiltConfig, ServerConfigProps | '$plugins'
382
386
  navigation: NavigationConfig;
383
387
  components: {
384
388
  header: Component[];
385
- collectionHeader?: Component[];
389
+ collectionHeader?: Component<{
390
+ config: BuiltCollectionClient;
391
+ }>[];
386
392
  dashboard?: Component<{
387
393
  entries: DashboardEntry[];
388
394
  user?: User;
@@ -95,7 +95,7 @@
95
95
 
96
96
  {#snippet topRight()}
97
97
  {#each config.raw.panel.components.collectionHeader || [] as CustomHeaderComponent, index (index)}
98
- <CustomHeaderComponent />
98
+ <CustomHeaderComponent config={collectionConfig} />
99
99
  {/each}
100
100
 
101
101
  <LanguageSwitcher onLocalClick={() => invalidateAll()} />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rimecms",
3
- "version": "0.31.2",
3
+ "version": "0.31.3",
4
4
  "homepage": "https://github.com/bienbiendev/rime",
5
5
  "scripts": {
6
6
  "dev": "vite dev",