@dyrected/sdk 2.5.36 → 2.5.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/dist/index.cjs CHANGED
@@ -165,15 +165,23 @@ var DyrectedClient = class {
165
165
  async getSchemas() {
166
166
  return this.request("/api/schemas");
167
167
  }
168
- async getPreference(key) {
169
- return this.request(`/api/preferences/${encodeURIComponent(key)}`);
168
+ async getPreference(key, options) {
169
+ const scopeParam = options?.scope ? `?scope=${options.scope}` : "";
170
+ return this.request(`/api/preferences/${encodeURIComponent(key)}${scopeParam}`);
170
171
  }
171
- async setPreference(key, value) {
172
- return this.request(`/api/preferences/${encodeURIComponent(key)}`, {
172
+ async setPreference(key, value, options) {
173
+ const scopeParam = options?.scope ? `?scope=${options.scope}` : "";
174
+ return this.request(`/api/preferences/${encodeURIComponent(key)}${scopeParam}`, {
173
175
  method: "PUT",
174
176
  body: JSON.stringify({ value })
175
177
  });
176
178
  }
179
+ async deletePreference(key, options) {
180
+ const scopeParam = options?.scope ? `?scope=${options.scope}` : "";
181
+ return this.request(`/api/preferences/${encodeURIComponent(key)}${scopeParam}`, {
182
+ method: "DELETE"
183
+ });
184
+ }
177
185
  /**
178
186
  * Fetch draft data for a specific preview token.
179
187
  * Used in "token" preview mode.
package/dist/index.d.cts CHANGED
@@ -144,14 +144,23 @@ declare class DyrectedClient<TSchema extends BaseSchema = any> {
144
144
  collections: any[];
145
145
  globals: any[];
146
146
  }>;
147
- getPreference<T = unknown>(key: string): Promise<{
147
+ getPreference<T = unknown>(key: string, options?: {
148
+ scope?: 'personal' | 'global';
149
+ }): Promise<{
148
150
  key: string;
149
151
  value: T | null;
150
152
  }>;
151
- setPreference<T = unknown>(key: string, value: T): Promise<{
153
+ setPreference<T = unknown>(key: string, value: T, options?: {
154
+ scope?: 'personal' | 'global';
155
+ }): Promise<{
152
156
  key: string;
153
157
  value: T;
154
158
  }>;
159
+ deletePreference(key: string, options?: {
160
+ scope?: 'personal' | 'global';
161
+ }): Promise<{
162
+ success: boolean;
163
+ }>;
155
164
  /**
156
165
  * Fetch draft data for a specific preview token.
157
166
  * Used in "token" preview mode.
package/dist/index.d.ts CHANGED
@@ -144,14 +144,23 @@ declare class DyrectedClient<TSchema extends BaseSchema = any> {
144
144
  collections: any[];
145
145
  globals: any[];
146
146
  }>;
147
- getPreference<T = unknown>(key: string): Promise<{
147
+ getPreference<T = unknown>(key: string, options?: {
148
+ scope?: 'personal' | 'global';
149
+ }): Promise<{
148
150
  key: string;
149
151
  value: T | null;
150
152
  }>;
151
- setPreference<T = unknown>(key: string, value: T): Promise<{
153
+ setPreference<T = unknown>(key: string, value: T, options?: {
154
+ scope?: 'personal' | 'global';
155
+ }): Promise<{
152
156
  key: string;
153
157
  value: T;
154
158
  }>;
159
+ deletePreference(key: string, options?: {
160
+ scope?: 'personal' | 'global';
161
+ }): Promise<{
162
+ success: boolean;
163
+ }>;
155
164
  /**
156
165
  * Fetch draft data for a specific preview token.
157
166
  * Used in "token" preview mode.
package/dist/index.js CHANGED
@@ -137,15 +137,23 @@ var DyrectedClient = class {
137
137
  async getSchemas() {
138
138
  return this.request("/api/schemas");
139
139
  }
140
- async getPreference(key) {
141
- return this.request(`/api/preferences/${encodeURIComponent(key)}`);
140
+ async getPreference(key, options) {
141
+ const scopeParam = options?.scope ? `?scope=${options.scope}` : "";
142
+ return this.request(`/api/preferences/${encodeURIComponent(key)}${scopeParam}`);
142
143
  }
143
- async setPreference(key, value) {
144
- return this.request(`/api/preferences/${encodeURIComponent(key)}`, {
144
+ async setPreference(key, value, options) {
145
+ const scopeParam = options?.scope ? `?scope=${options.scope}` : "";
146
+ return this.request(`/api/preferences/${encodeURIComponent(key)}${scopeParam}`, {
145
147
  method: "PUT",
146
148
  body: JSON.stringify({ value })
147
149
  });
148
150
  }
151
+ async deletePreference(key, options) {
152
+ const scopeParam = options?.scope ? `?scope=${options.scope}` : "";
153
+ return this.request(`/api/preferences/${encodeURIComponent(key)}${scopeParam}`, {
154
+ method: "DELETE"
155
+ });
156
+ }
149
157
  /**
150
158
  * Fetch draft data for a specific preview token.
151
159
  * Used in "token" preview mode.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dyrected/sdk",
3
- "version": "2.5.36",
3
+ "version": "2.5.39",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -30,7 +30,7 @@
30
30
  "tsup": "^8.5.1",
31
31
  "typescript": "^5.4.5",
32
32
  "vitest": "^1.0.0",
33
- "@dyrected/core": "2.5.36"
33
+ "@dyrected/core": "2.5.39"
34
34
  },
35
35
  "license": "BSL-1.1",
36
36
  "author": "Busola Okeowo <busolaokemoney@gmail.com>",