@dyrected/sdk 1.0.9 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -24,6 +24,17 @@ declare class QueryBuilder<T = any> {
24
24
  then<TResult1 = PaginatedResult<T>, TResult2 = never>(onfulfilled?: ((value: PaginatedResult<T>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
25
25
  }
26
26
 
27
+ interface SetupPromptConfig {
28
+ siteName?: string;
29
+ siteId?: string;
30
+ apiKey?: string;
31
+ baseUrl?: string;
32
+ isSelfHosted?: boolean;
33
+ existingSite?: boolean;
34
+ }
35
+ declare function generateFreshSetupPrompt(activeTab: "next" | "nuxt" | "react" | "vue", config: SetupPromptConfig): string;
36
+ declare function generateAIPrompt(activeTab: "next" | "nuxt" | "react" | "vue", config: SetupPromptConfig): string;
37
+
27
38
  /**
28
39
  * Structured error thrown by the SDK when the server returns a non-2xx response.
29
40
  */
@@ -77,11 +88,11 @@ declare class DyrectedClient<TSchema extends BaseSchema = any> {
77
88
  * Used in "token" preview mode.
78
89
  */
79
90
  getPreviewData(token: string): Promise<any>;
80
- find<K extends keyof TSchema['collections']>(collection: K & string, args?: QueryArgs): Promise<PaginatedResult<TSchema['collections'][K]>>;
91
+ find<K extends keyof TSchema["collections"]>(collection: K & string, args?: QueryArgs): Promise<PaginatedResult<TSchema["collections"][K]>>;
81
92
  /**
82
93
  * Returns a fluent query builder for a collection.
83
94
  */
84
- collection<K extends keyof TSchema['collections']>(slug: K & string): {
95
+ collection<K extends keyof TSchema["collections"]>(slug: K & string): {
85
96
  find: (args?: QueryArgs) => QueryBuilder<TSchema["collections"][K]>;
86
97
  findOne: (id: string, args?: {
87
98
  depth?: number;
@@ -92,6 +103,9 @@ declare class DyrectedClient<TSchema extends BaseSchema = any> {
92
103
  delete: (id: string) => Promise<{
93
104
  message: string;
94
105
  }>;
106
+ deleteMany: (ids: string[]) => Promise<{
107
+ message: string;
108
+ }>;
95
109
  /**
96
110
  * Upload a file to this collection. Sends as multipart/form-data.
97
111
  * @param file - A File or Blob (browser) or Buffer with filename/mimeType (Node.js)
@@ -141,7 +155,7 @@ declare class DyrectedClient<TSchema extends BaseSchema = any> {
141
155
  * @example client.global('site-settings').get()
142
156
  * @example client.global('site-settings').update({ siteName: 'My Site' })
143
157
  */
144
- global<K extends keyof TSchema['globals']>(slug: K & string): {
158
+ global<K extends keyof TSchema["globals"]>(slug: K & string): {
145
159
  get: (args?: {
146
160
  depth?: number;
147
161
  initialData?: TSchema["globals"][K];
@@ -157,6 +171,9 @@ declare class DyrectedClient<TSchema extends BaseSchema = any> {
157
171
  delete(collection: string, id: string): Promise<{
158
172
  message: string;
159
173
  }>;
174
+ deleteMany(collection: string, ids: string[]): Promise<{
175
+ message: string;
176
+ }>;
160
177
  getGlobal<T = any>(slug: string, args?: {
161
178
  depth?: number;
162
179
  initialData?: T;
@@ -179,4 +196,4 @@ declare function createClient<TSchema extends {
179
196
  globals: any;
180
197
  } = any>(config: DyrectedClientConfig): DyrectedClient<TSchema>;
181
198
 
182
- export { type BaseSchema, DyrectedClient, type DyrectedClientConfig, DyrectedError, createClient };
199
+ export { type BaseSchema, DyrectedClient, type DyrectedClientConfig, DyrectedError, type SetupPromptConfig, createClient, generateAIPrompt, generateFreshSetupPrompt };
package/dist/index.d.ts CHANGED
@@ -24,6 +24,17 @@ declare class QueryBuilder<T = any> {
24
24
  then<TResult1 = PaginatedResult<T>, TResult2 = never>(onfulfilled?: ((value: PaginatedResult<T>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
25
25
  }
26
26
 
27
+ interface SetupPromptConfig {
28
+ siteName?: string;
29
+ siteId?: string;
30
+ apiKey?: string;
31
+ baseUrl?: string;
32
+ isSelfHosted?: boolean;
33
+ existingSite?: boolean;
34
+ }
35
+ declare function generateFreshSetupPrompt(activeTab: "next" | "nuxt" | "react" | "vue", config: SetupPromptConfig): string;
36
+ declare function generateAIPrompt(activeTab: "next" | "nuxt" | "react" | "vue", config: SetupPromptConfig): string;
37
+
27
38
  /**
28
39
  * Structured error thrown by the SDK when the server returns a non-2xx response.
29
40
  */
@@ -77,11 +88,11 @@ declare class DyrectedClient<TSchema extends BaseSchema = any> {
77
88
  * Used in "token" preview mode.
78
89
  */
79
90
  getPreviewData(token: string): Promise<any>;
80
- find<K extends keyof TSchema['collections']>(collection: K & string, args?: QueryArgs): Promise<PaginatedResult<TSchema['collections'][K]>>;
91
+ find<K extends keyof TSchema["collections"]>(collection: K & string, args?: QueryArgs): Promise<PaginatedResult<TSchema["collections"][K]>>;
81
92
  /**
82
93
  * Returns a fluent query builder for a collection.
83
94
  */
84
- collection<K extends keyof TSchema['collections']>(slug: K & string): {
95
+ collection<K extends keyof TSchema["collections"]>(slug: K & string): {
85
96
  find: (args?: QueryArgs) => QueryBuilder<TSchema["collections"][K]>;
86
97
  findOne: (id: string, args?: {
87
98
  depth?: number;
@@ -92,6 +103,9 @@ declare class DyrectedClient<TSchema extends BaseSchema = any> {
92
103
  delete: (id: string) => Promise<{
93
104
  message: string;
94
105
  }>;
106
+ deleteMany: (ids: string[]) => Promise<{
107
+ message: string;
108
+ }>;
95
109
  /**
96
110
  * Upload a file to this collection. Sends as multipart/form-data.
97
111
  * @param file - A File or Blob (browser) or Buffer with filename/mimeType (Node.js)
@@ -141,7 +155,7 @@ declare class DyrectedClient<TSchema extends BaseSchema = any> {
141
155
  * @example client.global('site-settings').get()
142
156
  * @example client.global('site-settings').update({ siteName: 'My Site' })
143
157
  */
144
- global<K extends keyof TSchema['globals']>(slug: K & string): {
158
+ global<K extends keyof TSchema["globals"]>(slug: K & string): {
145
159
  get: (args?: {
146
160
  depth?: number;
147
161
  initialData?: TSchema["globals"][K];
@@ -157,6 +171,9 @@ declare class DyrectedClient<TSchema extends BaseSchema = any> {
157
171
  delete(collection: string, id: string): Promise<{
158
172
  message: string;
159
173
  }>;
174
+ deleteMany(collection: string, ids: string[]): Promise<{
175
+ message: string;
176
+ }>;
160
177
  getGlobal<T = any>(slug: string, args?: {
161
178
  depth?: number;
162
179
  initialData?: T;
@@ -179,4 +196,4 @@ declare function createClient<TSchema extends {
179
196
  globals: any;
180
197
  } = any>(config: DyrectedClientConfig): DyrectedClient<TSchema>;
181
198
 
182
- export { type BaseSchema, DyrectedClient, type DyrectedClientConfig, DyrectedError, createClient };
199
+ export { type BaseSchema, DyrectedClient, type DyrectedClientConfig, DyrectedError, type SetupPromptConfig, createClient, generateAIPrompt, generateFreshSetupPrompt };