@salefony/api-sdk 1.0.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/README.md +675 -0
- package/dist/index.d.mts +1862 -0
- package/dist/index.d.ts +1862 -0
- package/dist/index.js +2310 -0
- package/dist/index.mjs +2246 -0
- package/package.json +64 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2246 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/core/client.ts
|
|
8
|
+
import axios, { isAxiosError } from "axios";
|
|
9
|
+
|
|
10
|
+
// src/core/errors.ts
|
|
11
|
+
var SalefonyError = class _SalefonyError extends Error {
|
|
12
|
+
constructor(message, statusCode, rawError, requestContext) {
|
|
13
|
+
const contextMsg = requestContext?.url ? ` [${requestContext.method || "GET"} ${requestContext.url}]` : "";
|
|
14
|
+
super(`${message}${contextMsg}`);
|
|
15
|
+
this.statusCode = statusCode;
|
|
16
|
+
this.rawError = rawError;
|
|
17
|
+
this.requestContext = requestContext;
|
|
18
|
+
this.name = "SalefonyError";
|
|
19
|
+
Object.setPrototypeOf(this, _SalefonyError.prototype);
|
|
20
|
+
}
|
|
21
|
+
/** Validation hataları için field-wise detaylar */
|
|
22
|
+
get details() {
|
|
23
|
+
return this.rawError?.errors ?? this.rawError;
|
|
24
|
+
}
|
|
25
|
+
/** Hata sunucudan mı geldi (5xx) */
|
|
26
|
+
get isServerError() {
|
|
27
|
+
return (this.statusCode ?? 0) >= 500;
|
|
28
|
+
}
|
|
29
|
+
/** İstemci hatası mı (4xx) */
|
|
30
|
+
get isClientError() {
|
|
31
|
+
const s = this.statusCode ?? 0;
|
|
32
|
+
return s >= 400 && s < 500;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var SalefonyAuthError = class extends SalefonyError {
|
|
36
|
+
constructor(message, statusCode = 401, rawError, requestContext) {
|
|
37
|
+
super(message, statusCode, rawError, requestContext);
|
|
38
|
+
this.name = "SalefonyAuthError";
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var SalefonyValidationError = class extends SalefonyError {
|
|
42
|
+
constructor(message, statusCode = 400, rawError, requestContext) {
|
|
43
|
+
super(message, statusCode, rawError, requestContext);
|
|
44
|
+
this.name = "SalefonyValidationError";
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var SalefonyNotFoundError = class extends SalefonyError {
|
|
48
|
+
constructor(message, rawError, requestContext) {
|
|
49
|
+
super(message, 404, rawError, requestContext);
|
|
50
|
+
this.name = "SalefonyNotFoundError";
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/core/client.ts
|
|
55
|
+
var ApiClient = class {
|
|
56
|
+
constructor(config) {
|
|
57
|
+
this.config = config;
|
|
58
|
+
this.axiosInstance = axios.create({
|
|
59
|
+
baseURL: config.baseUrl,
|
|
60
|
+
timeout: config.timeout || 3e4,
|
|
61
|
+
headers: {
|
|
62
|
+
"Content-Type": "application/json",
|
|
63
|
+
...config.headers
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
this.initializeInterceptors();
|
|
67
|
+
this.updateAuthHeaders();
|
|
68
|
+
}
|
|
69
|
+
axiosInstance;
|
|
70
|
+
initializeInterceptors() {
|
|
71
|
+
this.axiosInstance.interceptors.request.use((config) => {
|
|
72
|
+
if (this.config.debug) {
|
|
73
|
+
console.log(`%c[SDK Request] %c${config.method?.toUpperCase()} %c${config.url}`, "color: #3b82f6; font-weight: bold", "color: #10b981", "color: #6b7280");
|
|
74
|
+
}
|
|
75
|
+
return config;
|
|
76
|
+
});
|
|
77
|
+
this.axiosInstance.interceptors.response.use(
|
|
78
|
+
(response) => {
|
|
79
|
+
if (this.config.debug) {
|
|
80
|
+
console.log(`%c[SDK Response] %c${response.status} %c${response.config.url}`, "color: #3b82f6; font-weight: bold", "color: #10b981", "color: #6b7280");
|
|
81
|
+
}
|
|
82
|
+
return response;
|
|
83
|
+
},
|
|
84
|
+
async (error) => {
|
|
85
|
+
const { config, response } = error;
|
|
86
|
+
const shouldRetry = config && this.config.retries && (!config.__retryCount || config.__retryCount < this.config.retries);
|
|
87
|
+
const isRetryableError = !response || response.status >= 500 && response.status <= 599;
|
|
88
|
+
if (shouldRetry && isRetryableError) {
|
|
89
|
+
config.__retryCount = (config.__retryCount || 0) + 1;
|
|
90
|
+
const delay = config.__retryCount * 1e3;
|
|
91
|
+
if (this.config.debug) {
|
|
92
|
+
console.warn(`[SDK Retry] Attempt ${config.__retryCount} for ${config.url}. Waiting ${delay}ms...`);
|
|
93
|
+
}
|
|
94
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
95
|
+
return this.axiosInstance(config);
|
|
96
|
+
}
|
|
97
|
+
if (isAxiosError(error)) {
|
|
98
|
+
const status = error.response?.status;
|
|
99
|
+
const message = error.response?.data?.message || error.response?.data?.error || error.message;
|
|
100
|
+
const requestContext = error.config ? { method: error.config.method, url: error.config.url } : void 0;
|
|
101
|
+
switch (status) {
|
|
102
|
+
case 401:
|
|
103
|
+
case 403:
|
|
104
|
+
throw new SalefonyAuthError(message, status, error.response?.data, requestContext);
|
|
105
|
+
case 404:
|
|
106
|
+
throw new SalefonyNotFoundError(message, error.response?.data, requestContext);
|
|
107
|
+
case 400:
|
|
108
|
+
case 422:
|
|
109
|
+
throw new SalefonyValidationError(message, status, error.response?.data, requestContext);
|
|
110
|
+
default:
|
|
111
|
+
throw new SalefonyError(message, status, error.response?.data, requestContext);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
throw new SalefonyError(error instanceof Error ? error.message : "Unknown error");
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
updateAuthHeaders() {
|
|
119
|
+
if (this.config.apiKey) {
|
|
120
|
+
this.axiosInstance.defaults.headers.common["x-api-key"] = this.config.apiKey;
|
|
121
|
+
}
|
|
122
|
+
if (this.config.authToken) {
|
|
123
|
+
this.axiosInstance.defaults.headers.common["Authorization"] = `Bearer ${this.config.authToken}`;
|
|
124
|
+
}
|
|
125
|
+
if (this.config.vendorKey) {
|
|
126
|
+
this.axiosInstance.defaults.headers.common["x-vendor-key"] = this.config.vendorKey;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Bearer token ayarlar (Chainable)
|
|
131
|
+
*/
|
|
132
|
+
setAuthToken(token) {
|
|
133
|
+
this.axiosInstance.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Vendor API anahtarı ayarlar (Chainable)
|
|
138
|
+
*/
|
|
139
|
+
setVendorKey(key) {
|
|
140
|
+
this.axiosInstance.defaults.headers.common["x-vendor-key"] = key;
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Ekstra headerlar ekler (Chainable)
|
|
145
|
+
*/
|
|
146
|
+
setExtraHeaders(headers) {
|
|
147
|
+
Object.assign(this.axiosInstance.defaults.headers.common, headers);
|
|
148
|
+
return this;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Bearer token temizler (Chainable)
|
|
152
|
+
*/
|
|
153
|
+
clearAuth() {
|
|
154
|
+
delete this.axiosInstance.defaults.headers.common["Authorization"];
|
|
155
|
+
return this;
|
|
156
|
+
}
|
|
157
|
+
get instance() {
|
|
158
|
+
return this.axiosInstance;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// src/resources/admin/index.ts
|
|
163
|
+
var admin_exports = {};
|
|
164
|
+
__export(admin_exports, {
|
|
165
|
+
ApiKeyResource: () => ApiKeyResource,
|
|
166
|
+
AuthResource: () => AuthResource,
|
|
167
|
+
CloudflareResource: () => CloudflareResource,
|
|
168
|
+
CollectionResource: () => CollectionResource,
|
|
169
|
+
ContentResource: () => ContentResource,
|
|
170
|
+
CustomDataResource: () => CustomDataResource,
|
|
171
|
+
DatasourceResource: () => DatasourceResource,
|
|
172
|
+
GoogleResource: () => GoogleResource,
|
|
173
|
+
LanguageResource: () => LanguageResource,
|
|
174
|
+
LayoutResource: () => LayoutResource,
|
|
175
|
+
MediaResource: () => MediaResource,
|
|
176
|
+
MetadataResource: () => MetadataResource,
|
|
177
|
+
NavigationResource: () => NavigationResource,
|
|
178
|
+
ProjectResource: () => ProjectResource,
|
|
179
|
+
PurchaseResource: () => PurchaseResource,
|
|
180
|
+
ReviewResource: () => ReviewResource,
|
|
181
|
+
SEOResource: () => SEOResource,
|
|
182
|
+
SectionResource: () => SectionResource,
|
|
183
|
+
SectorResource: () => SectorResource,
|
|
184
|
+
SettingsResource: () => SettingsResource,
|
|
185
|
+
StoreResource: () => StoreResource,
|
|
186
|
+
SubscriptionResource: () => SubscriptionResource,
|
|
187
|
+
ThemeResource: () => ThemeResource,
|
|
188
|
+
VendorResource: () => VendorResource,
|
|
189
|
+
WebmailResource: () => WebmailResource,
|
|
190
|
+
apiKeyColumns: () => apiKeyColumns,
|
|
191
|
+
collectionColumns: () => collectionColumns,
|
|
192
|
+
contentColumns: () => contentColumns,
|
|
193
|
+
datasourceColumns: () => datasourceColumns,
|
|
194
|
+
languageColumns: () => languageColumns,
|
|
195
|
+
layoutColumns: () => layoutColumns,
|
|
196
|
+
metadataColumns: () => metadataColumns,
|
|
197
|
+
navigationColumns: () => navigationColumns,
|
|
198
|
+
projectColumns: () => projectColumns,
|
|
199
|
+
sectionColumns: () => sectionColumns,
|
|
200
|
+
sectorColumns: () => sectorColumns,
|
|
201
|
+
storeColumns: () => storeColumns,
|
|
202
|
+
vendorColumns: () => vendorColumns
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// src/core/cache.ts
|
|
206
|
+
var SdkCache = class {
|
|
207
|
+
cache = /* @__PURE__ */ new Map();
|
|
208
|
+
/**
|
|
209
|
+
* @param key Cache key
|
|
210
|
+
* @param ttl Time to live in milliseconds (default 30s)
|
|
211
|
+
*/
|
|
212
|
+
set(key, data, ttl = 3e4) {
|
|
213
|
+
this.cache.set(key, {
|
|
214
|
+
data,
|
|
215
|
+
expiry: Date.now() + ttl
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
get(key) {
|
|
219
|
+
const cached = this.cache.get(key);
|
|
220
|
+
if (!cached) return null;
|
|
221
|
+
if (Date.now() > cached.expiry) {
|
|
222
|
+
this.cache.delete(key);
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
return cached.data;
|
|
226
|
+
}
|
|
227
|
+
clear() {
|
|
228
|
+
this.cache.clear();
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
var sdkCache = new SdkCache();
|
|
232
|
+
|
|
233
|
+
// src/resources/base.ts
|
|
234
|
+
var BaseResource = class {
|
|
235
|
+
constructor(httpClient) {
|
|
236
|
+
this.httpClient = httpClient;
|
|
237
|
+
}
|
|
238
|
+
async request(config, options) {
|
|
239
|
+
const cacheKey = options?.cache ? `${config.method}:${config.url}:${JSON.stringify(config.params || config.data)}` : null;
|
|
240
|
+
if (cacheKey) {
|
|
241
|
+
const cached = sdkCache.get(cacheKey);
|
|
242
|
+
if (cached) return cached;
|
|
243
|
+
}
|
|
244
|
+
const response = await this.httpClient.request({
|
|
245
|
+
...config,
|
|
246
|
+
headers: { ...config.headers, ...options?.headers }
|
|
247
|
+
});
|
|
248
|
+
if (cacheKey && options?.cache) {
|
|
249
|
+
sdkCache.set(cacheKey, response.data, options.cache);
|
|
250
|
+
}
|
|
251
|
+
return response.data;
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var QueryBuilder = class {
|
|
255
|
+
constructor(resource) {
|
|
256
|
+
this.resource = resource;
|
|
257
|
+
}
|
|
258
|
+
args = {};
|
|
259
|
+
/** Add columns (dot notation) - typed for autocomplete */
|
|
260
|
+
columns(...cols) {
|
|
261
|
+
this.args.columns = [...this.args.columns || [], ...cols];
|
|
262
|
+
return this;
|
|
263
|
+
}
|
|
264
|
+
/** Add filter (LINQ Where) */
|
|
265
|
+
where(where) {
|
|
266
|
+
this.args.filter = { ...this.args.filter, ...where };
|
|
267
|
+
this.args.where = { ...this.args.where, ...where };
|
|
268
|
+
return this;
|
|
269
|
+
}
|
|
270
|
+
/** Add filter (alias) */
|
|
271
|
+
filter(filter) {
|
|
272
|
+
this.args.filter = { ...this.args.filter, ...filter };
|
|
273
|
+
return this;
|
|
274
|
+
}
|
|
275
|
+
/** Sort: "field:asc" or "field:desc" */
|
|
276
|
+
sort(sort) {
|
|
277
|
+
this.args.sort = sort;
|
|
278
|
+
return this;
|
|
279
|
+
}
|
|
280
|
+
/** Artan sıralama (LINQ OrderBy) */
|
|
281
|
+
orderBy(orderBy) {
|
|
282
|
+
const str = typeof orderBy === "object" && !Array.isArray(orderBy) ? `${Object.keys(orderBy)[0]}:${orderBy[Object.keys(orderBy)[0]] || "asc"}` : String(orderBy);
|
|
283
|
+
this.args.sort = str;
|
|
284
|
+
return this;
|
|
285
|
+
}
|
|
286
|
+
/** Azalan sıralama (LINQ OrderByDescending) */
|
|
287
|
+
orderByDescending(field) {
|
|
288
|
+
const f = typeof field === "string" ? field : Object.keys(field)[0];
|
|
289
|
+
this.args.sort = `${f}:desc`;
|
|
290
|
+
return this;
|
|
291
|
+
}
|
|
292
|
+
/** @deprecated Use columns() */
|
|
293
|
+
include(include) {
|
|
294
|
+
this.args.include = include;
|
|
295
|
+
return this;
|
|
296
|
+
}
|
|
297
|
+
/** @deprecated Use columns() */
|
|
298
|
+
select(select) {
|
|
299
|
+
this.args.select = select;
|
|
300
|
+
return this;
|
|
301
|
+
}
|
|
302
|
+
/** Alınacak kayıt sayısı (LINQ Take) */
|
|
303
|
+
take(take) {
|
|
304
|
+
this.args.take = take;
|
|
305
|
+
this.args.paginate = { ...this.args.paginate, limit: take };
|
|
306
|
+
return this;
|
|
307
|
+
}
|
|
308
|
+
/** Atlanacak kayıt sayısı (LINQ Skip) */
|
|
309
|
+
skip(skip) {
|
|
310
|
+
this.args.skip = skip;
|
|
311
|
+
this.args.paginate = { ...this.args.paginate, page: Math.floor(skip / (this.args.paginate?.limit || 20)) + 1 };
|
|
312
|
+
return this;
|
|
313
|
+
}
|
|
314
|
+
/** Sorguyu çalıştır - liste döner (LINQ ToList) */
|
|
315
|
+
async toList(options) {
|
|
316
|
+
const listParams = {
|
|
317
|
+
...this.args.columns?.length && { columns: this.args.columns },
|
|
318
|
+
...this.args.filter && { filter: this.args.filter },
|
|
319
|
+
...this.args.where && { where: this.args.where },
|
|
320
|
+
...this.args.paginate && { paginate: this.args.paginate },
|
|
321
|
+
...this.args.sort && { sort: this.args.sort },
|
|
322
|
+
...this.args.take != null && { take: this.args.take },
|
|
323
|
+
...this.args.skip != null && { skip: this.args.skip },
|
|
324
|
+
...this.args.include && { include: this.args.include }
|
|
325
|
+
};
|
|
326
|
+
return this.resource.list(listParams, options);
|
|
327
|
+
}
|
|
328
|
+
/** Sorguyu çalıştır - liste döner (execute alias) */
|
|
329
|
+
async execute(options) {
|
|
330
|
+
return this.toList(options);
|
|
331
|
+
}
|
|
332
|
+
/** İlk kaydı getir, yoksa hata (LINQ First) */
|
|
333
|
+
async first(options) {
|
|
334
|
+
const args = { ...this.args, take: 1, skip: 0 };
|
|
335
|
+
const res = await this.resource.list(args, options);
|
|
336
|
+
const items = res.data ?? [];
|
|
337
|
+
if (items.length === 0) throw new Error("Sequence contains no elements");
|
|
338
|
+
return { data: items[0], meta: res.meta };
|
|
339
|
+
}
|
|
340
|
+
/** İlk kaydı getir, yoksa null (LINQ FirstOrDefault) */
|
|
341
|
+
async firstOrDefault(options) {
|
|
342
|
+
try {
|
|
343
|
+
const res = await this.first(options);
|
|
344
|
+
return res;
|
|
345
|
+
} catch {
|
|
346
|
+
return { data: null };
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
/** Tek kayıt bekle, 0 veya 2+ ise hata (LINQ Single) */
|
|
350
|
+
async single(options) {
|
|
351
|
+
const args = { ...this.args, take: 2 };
|
|
352
|
+
const res = await this.resource.list(args, options);
|
|
353
|
+
const items = res.data ?? [];
|
|
354
|
+
if (items.length === 0) throw new Error("Sequence contains no elements");
|
|
355
|
+
if (items.length > 1) throw new Error("Sequence contains more than one element");
|
|
356
|
+
return { data: items[0], meta: res.meta };
|
|
357
|
+
}
|
|
358
|
+
/** Tek kayıt bekle, yoksa null (LINQ SingleOrDefault) */
|
|
359
|
+
async singleOrDefault(options) {
|
|
360
|
+
try {
|
|
361
|
+
return await this.single(options);
|
|
362
|
+
} catch {
|
|
363
|
+
return { data: null };
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
/** Kayıt sayısı (LINQ Count) */
|
|
367
|
+
async count(options) {
|
|
368
|
+
return this.resource.count({ where: this.args.where }, options);
|
|
369
|
+
}
|
|
370
|
+
/** En az bir kayıt var mı (LINQ Any) */
|
|
371
|
+
async any(options) {
|
|
372
|
+
const n = await this.count(options);
|
|
373
|
+
return n > 0;
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
var CrudResource = class extends BaseResource {
|
|
377
|
+
constructor(httpClient, path) {
|
|
378
|
+
super(httpClient);
|
|
379
|
+
this.path = path;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* LINQ tarzı fluent query başlatır (boş)
|
|
383
|
+
*/
|
|
384
|
+
query() {
|
|
385
|
+
return new QueryBuilder(this);
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* LINQ tarzı chain başlatır - where ile.
|
|
389
|
+
* @example sdk.admin.collections.where({ isActive: true }).orderBy({ order: 'asc' }).take(10).toList()
|
|
390
|
+
*/
|
|
391
|
+
where(where) {
|
|
392
|
+
return new QueryBuilder(this).where(where);
|
|
393
|
+
}
|
|
394
|
+
// ─── Backend-driven API (columns, filter, paginate, sort) ───────────────────
|
|
395
|
+
/**
|
|
396
|
+
* Get a single resource by ID.
|
|
397
|
+
* @param idOrParams - ID string or { id, columns?, language? }
|
|
398
|
+
* @example
|
|
399
|
+
* sdk.admin.collections.get('xyz');
|
|
400
|
+
* sdk.admin.collections.get({ id: 'xyz', columns: ['id', 'title', 'translations.*', 'parent.id'] });
|
|
401
|
+
*/
|
|
402
|
+
async get(idOrParams, options) {
|
|
403
|
+
const resolved = typeof idOrParams === "string" ? { id: idOrParams } : idOrParams;
|
|
404
|
+
const id = resolved.id;
|
|
405
|
+
const cols = resolved.columns;
|
|
406
|
+
const lang = resolved.language;
|
|
407
|
+
const legacy = resolved;
|
|
408
|
+
const backendArgs = {
|
|
409
|
+
where: { id },
|
|
410
|
+
...cols && { columns: Array.isArray(cols) ? cols : [cols] },
|
|
411
|
+
...lang && { language: lang }
|
|
412
|
+
};
|
|
413
|
+
if (legacy.include != null) backendArgs.include = legacy.include;
|
|
414
|
+
if (legacy.select != null) backendArgs.select = legacy.select;
|
|
415
|
+
return this.request({
|
|
416
|
+
method: "GET",
|
|
417
|
+
url: `${this.path}/findUnique`,
|
|
418
|
+
params: { q: JSON.stringify(backendArgs) }
|
|
419
|
+
}, options);
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* List resources with columns, filter, paginate, sort.
|
|
423
|
+
* @example
|
|
424
|
+
* sdk.admin.collections.list({
|
|
425
|
+
* columns: ['id', 'title', 'translations.*', 'parent.id'],
|
|
426
|
+
* filter: { isActive: true },
|
|
427
|
+
* paginate: { page: 1, limit: 20 },
|
|
428
|
+
* sort: 'order:asc'
|
|
429
|
+
* });
|
|
430
|
+
*/
|
|
431
|
+
async list(params, options) {
|
|
432
|
+
if (!params) {
|
|
433
|
+
return this.request({
|
|
434
|
+
method: "GET",
|
|
435
|
+
url: `${this.path}/findMany`
|
|
436
|
+
}, options);
|
|
437
|
+
}
|
|
438
|
+
const backendArgs = {};
|
|
439
|
+
if (params.columns) {
|
|
440
|
+
backendArgs.columns = Array.isArray(params.columns) ? params.columns : [params.columns];
|
|
441
|
+
}
|
|
442
|
+
if (params.filter) backendArgs.filter = params.filter;
|
|
443
|
+
if (params.where) backendArgs.where = params.where;
|
|
444
|
+
if (params.paginate) {
|
|
445
|
+
backendArgs.page = params.paginate.page ?? 1;
|
|
446
|
+
backendArgs.limit = params.paginate.limit ?? 20;
|
|
447
|
+
}
|
|
448
|
+
if (params.take != null) backendArgs.take = params.take;
|
|
449
|
+
if (params.skip != null) backendArgs.skip = params.skip;
|
|
450
|
+
if (params.sort) backendArgs.sort = params.sort;
|
|
451
|
+
if (params.search) backendArgs.search = params.search;
|
|
452
|
+
if (params.language) backendArgs.language = params.language;
|
|
453
|
+
if (params.orderBy) backendArgs.orderBy = params.orderBy;
|
|
454
|
+
if (params.include) backendArgs.include = params.include;
|
|
455
|
+
return this.request({
|
|
456
|
+
method: "GET",
|
|
457
|
+
url: `${this.path}/findMany`,
|
|
458
|
+
params: { q: JSON.stringify(backendArgs) }
|
|
459
|
+
}, options);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Edit (update) a resource by ID (Cloudflare-style).
|
|
463
|
+
* @example await client.admin.collections.edit('xyz', { name: 'New Name' })
|
|
464
|
+
*/
|
|
465
|
+
async edit(id, data, options) {
|
|
466
|
+
return this.request({
|
|
467
|
+
method: "PUT",
|
|
468
|
+
url: `${this.path}/${id}`,
|
|
469
|
+
data
|
|
470
|
+
}, options);
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Delete a resource by ID (Cloudflare-style).
|
|
474
|
+
* @example await client.admin.collections.delete('xyz')
|
|
475
|
+
*/
|
|
476
|
+
async deleteById(id, options) {
|
|
477
|
+
await this.request({
|
|
478
|
+
method: "DELETE",
|
|
479
|
+
url: `${this.path}/${id}`
|
|
480
|
+
}, options);
|
|
481
|
+
}
|
|
482
|
+
// ─── Legacy / Prisma-style API (Geriye uyumluluk) ───────────────────────────
|
|
483
|
+
/** @deprecated Use list() instead */
|
|
484
|
+
async findMany(args, options) {
|
|
485
|
+
return this.list(args, options);
|
|
486
|
+
}
|
|
487
|
+
async count(args, options) {
|
|
488
|
+
const response = await this.request({
|
|
489
|
+
method: "GET",
|
|
490
|
+
url: `${this.path}/count`,
|
|
491
|
+
params: args ? { q: JSON.stringify(args) } : void 0
|
|
492
|
+
}, options);
|
|
493
|
+
return response.count || 0;
|
|
494
|
+
}
|
|
495
|
+
/** @deprecated Use list() with take: 1 */
|
|
496
|
+
async findFirst(args, options) {
|
|
497
|
+
return this.request({
|
|
498
|
+
method: "GET",
|
|
499
|
+
url: `${this.path}/findFirst`,
|
|
500
|
+
params: args ? { q: JSON.stringify(args) } : void 0
|
|
501
|
+
}, options);
|
|
502
|
+
}
|
|
503
|
+
/** @deprecated Use get() instead */
|
|
504
|
+
async findUnique(args, options) {
|
|
505
|
+
return this.request({
|
|
506
|
+
method: "GET",
|
|
507
|
+
url: `${this.path}/findUnique`,
|
|
508
|
+
params: { q: JSON.stringify(args) }
|
|
509
|
+
}, options);
|
|
510
|
+
}
|
|
511
|
+
async create(data, options) {
|
|
512
|
+
return this.request({
|
|
513
|
+
method: "POST",
|
|
514
|
+
url: `${this.path}/create`,
|
|
515
|
+
data
|
|
516
|
+
}, options);
|
|
517
|
+
}
|
|
518
|
+
async update(where, data, options) {
|
|
519
|
+
return this.request({
|
|
520
|
+
method: "PATCH",
|
|
521
|
+
url: `${this.path}/update`,
|
|
522
|
+
data: { where, data }
|
|
523
|
+
}, options);
|
|
524
|
+
}
|
|
525
|
+
/** @deprecated Use deleteById() instead */
|
|
526
|
+
async delete(where, options) {
|
|
527
|
+
return this.request({
|
|
528
|
+
method: "DELETE",
|
|
529
|
+
url: `${this.path}/delete`,
|
|
530
|
+
data: { where }
|
|
531
|
+
}, options);
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
// src/resources/admin/vendor.ts
|
|
536
|
+
var vendorColumns = (...cols) => cols;
|
|
537
|
+
var VendorResource = class extends CrudResource {
|
|
538
|
+
constructor(httpClient, path = "/api/admin/vendors") {
|
|
539
|
+
super(httpClient, path);
|
|
540
|
+
}
|
|
541
|
+
async deactivate(id) {
|
|
542
|
+
return this.update({ id }, { isActive: false });
|
|
543
|
+
}
|
|
544
|
+
async activate(id) {
|
|
545
|
+
return this.update({ id }, { isActive: true });
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
// src/resources/admin/section.ts
|
|
550
|
+
var sectionColumns = (...cols) => cols;
|
|
551
|
+
var SectionResource = class extends CrudResource {
|
|
552
|
+
constructor(httpClient) {
|
|
553
|
+
super(httpClient, "/api/admin/sections");
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
// src/resources/admin/theme.ts
|
|
558
|
+
var ThemeResource = class extends BaseResource {
|
|
559
|
+
constructor(httpClient) {
|
|
560
|
+
super(httpClient);
|
|
561
|
+
}
|
|
562
|
+
async getAll() {
|
|
563
|
+
return this.request({
|
|
564
|
+
method: "GET",
|
|
565
|
+
url: "/api/admin/themes"
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
async getInstalled() {
|
|
569
|
+
return this.request({
|
|
570
|
+
method: "GET",
|
|
571
|
+
url: "/api/admin/themes/installed"
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
async install(themeId) {
|
|
575
|
+
return this.request({
|
|
576
|
+
method: "POST",
|
|
577
|
+
url: "/api/admin/themes/install",
|
|
578
|
+
data: { themeId }
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
async getById(id) {
|
|
582
|
+
return this.request({
|
|
583
|
+
method: "GET",
|
|
584
|
+
url: `/api/admin/themes/${id}`
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
// src/resources/admin/layout.ts
|
|
590
|
+
var layoutColumns = (...cols) => cols;
|
|
591
|
+
var LayoutResource = class extends CrudResource {
|
|
592
|
+
constructor(httpClient, path = "/api/admin/layouts") {
|
|
593
|
+
super(httpClient, path);
|
|
594
|
+
}
|
|
595
|
+
async getLayout(id) {
|
|
596
|
+
return this.request({
|
|
597
|
+
method: "GET",
|
|
598
|
+
url: `${this.path}/${id}/layout`
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
async updateLayout(id, data) {
|
|
602
|
+
return this.request({
|
|
603
|
+
method: "PUT",
|
|
604
|
+
url: `${this.path}/${id}/layout`,
|
|
605
|
+
data
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
async getEditInfo(previewUrl) {
|
|
609
|
+
return this.request({
|
|
610
|
+
method: "GET",
|
|
611
|
+
url: `${this.path}/edit`,
|
|
612
|
+
params: { previewUrl }
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
async updateEditInfo(previewUrl, data) {
|
|
616
|
+
return this.request({
|
|
617
|
+
method: "PUT",
|
|
618
|
+
url: `${this.path}/edit`,
|
|
619
|
+
params: { previewUrl },
|
|
620
|
+
data
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
async getTranslate(id, language = "en", source) {
|
|
624
|
+
return this.request({
|
|
625
|
+
method: "GET",
|
|
626
|
+
url: `${this.path}/${id}/translate`,
|
|
627
|
+
params: { language, source }
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
async updateTranslate(id, data) {
|
|
631
|
+
return this.request({
|
|
632
|
+
method: "PUT",
|
|
633
|
+
url: `${this.path}/${id}/translate`,
|
|
634
|
+
data
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
// src/resources/admin/settings.ts
|
|
640
|
+
var SettingsResource = class extends BaseResource {
|
|
641
|
+
path = "/api/admin/settings";
|
|
642
|
+
constructor(httpClient, path) {
|
|
643
|
+
super(httpClient);
|
|
644
|
+
if (path) this.path = path;
|
|
645
|
+
}
|
|
646
|
+
async get() {
|
|
647
|
+
return this.request({
|
|
648
|
+
method: "GET",
|
|
649
|
+
url: this.path
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
async update(data) {
|
|
653
|
+
return this.request({
|
|
654
|
+
method: "POST",
|
|
655
|
+
url: this.path,
|
|
656
|
+
data
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
async initialize() {
|
|
660
|
+
return this.request({
|
|
661
|
+
method: "GET",
|
|
662
|
+
url: `${this.path}/initialize`
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
async getLinking() {
|
|
666
|
+
return this.request({
|
|
667
|
+
method: "GET",
|
|
668
|
+
url: `${this.path}/linking`
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
async deleteLinking(id) {
|
|
672
|
+
return this.request({
|
|
673
|
+
method: "DELETE",
|
|
674
|
+
url: `${this.path}/linking`,
|
|
675
|
+
data: { id }
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
async getSiteLinking() {
|
|
679
|
+
return this.request({
|
|
680
|
+
method: "GET",
|
|
681
|
+
url: `${this.path}/sitelinking`
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
async updateSiteLinking(data) {
|
|
685
|
+
return this.request({
|
|
686
|
+
method: "PUT",
|
|
687
|
+
url: `${this.path}/sitelinking`,
|
|
688
|
+
data
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
async getTranslate(id, source) {
|
|
692
|
+
return this.request({
|
|
693
|
+
method: "GET",
|
|
694
|
+
url: `${this.path}/${id}/translate`,
|
|
695
|
+
params: { source }
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
async updateTranslate(id, data) {
|
|
699
|
+
return this.request({
|
|
700
|
+
method: "PUT",
|
|
701
|
+
url: `${this.path}/${id}/translate`,
|
|
702
|
+
data
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
// src/resources/admin/api-key.ts
|
|
708
|
+
var apiKeyColumns = (...cols) => cols;
|
|
709
|
+
var ApiKeyResource = class extends CrudResource {
|
|
710
|
+
constructor(httpClient, path = "/api/admin/api-keys") {
|
|
711
|
+
super(httpClient, path);
|
|
712
|
+
}
|
|
713
|
+
async revoke(id) {
|
|
714
|
+
return this.request({
|
|
715
|
+
method: "POST",
|
|
716
|
+
url: `${this.path}/${id}/revoke`
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
// src/resources/admin/datasource.ts
|
|
722
|
+
var datasourceColumns = (...cols) => cols;
|
|
723
|
+
var DatasourceResource = class extends CrudResource {
|
|
724
|
+
constructor(httpClient, path = "/api/admin/datasource") {
|
|
725
|
+
super(httpClient, path);
|
|
726
|
+
}
|
|
727
|
+
async getById(id) {
|
|
728
|
+
return this.request({
|
|
729
|
+
method: "GET",
|
|
730
|
+
url: `${this.path}/${id}`
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
async updateLinking(id, linking) {
|
|
734
|
+
return this.request({
|
|
735
|
+
method: "PUT",
|
|
736
|
+
url: `${this.path}/${id}/linking`,
|
|
737
|
+
data: { linking }
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
async getTranslate(id, source) {
|
|
741
|
+
return this.request({
|
|
742
|
+
method: "GET",
|
|
743
|
+
url: `${this.path}/${id}/translate`,
|
|
744
|
+
params: { source }
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
async updateTranslate(id, data) {
|
|
748
|
+
return this.request({
|
|
749
|
+
method: "PUT",
|
|
750
|
+
url: `${this.path}/${id}/translate`,
|
|
751
|
+
data
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
// src/resources/admin/metadata.ts
|
|
757
|
+
var metadataColumns = (...cols) => cols;
|
|
758
|
+
var MetadataResource = class extends CrudResource {
|
|
759
|
+
constructor(httpClient, path = "/api/admin/metadata") {
|
|
760
|
+
super(httpClient, path);
|
|
761
|
+
}
|
|
762
|
+
/** Get metadata by ID (backend GET /:id) */
|
|
763
|
+
async getById(id) {
|
|
764
|
+
return this.request({
|
|
765
|
+
method: "GET",
|
|
766
|
+
url: `${this.path}/${id}`
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
/** @deprecated Use edit(id, data) instead */
|
|
770
|
+
async updateById(id, data) {
|
|
771
|
+
return this.edit(id, data);
|
|
772
|
+
}
|
|
773
|
+
/** Delete metadata (backend DELETE /:id) - Cloudflare-style */
|
|
774
|
+
async deleteById(id) {
|
|
775
|
+
await this.request({
|
|
776
|
+
method: "DELETE",
|
|
777
|
+
url: `${this.path}/${id}`
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Get metadata entry form
|
|
782
|
+
*/
|
|
783
|
+
async getEntryForm(metadataId) {
|
|
784
|
+
return this.request({
|
|
785
|
+
method: "GET",
|
|
786
|
+
url: `${this.path}/${metadataId}/entries`
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Create a meta entry
|
|
791
|
+
*/
|
|
792
|
+
async createEntry(metadataId, data) {
|
|
793
|
+
return this.request({
|
|
794
|
+
method: "POST",
|
|
795
|
+
url: `${this.path}/${metadataId}/entries`,
|
|
796
|
+
data
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Update a meta entry
|
|
801
|
+
*/
|
|
802
|
+
async updateEntry(metadataId, entryId, data) {
|
|
803
|
+
return this.request({
|
|
804
|
+
method: "PUT",
|
|
805
|
+
url: `${this.path}/${metadataId}/entries/${entryId}`,
|
|
806
|
+
data
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Delete a meta entry
|
|
811
|
+
*/
|
|
812
|
+
async deleteEntry(metadataId, entryId) {
|
|
813
|
+
return this.request({
|
|
814
|
+
method: "DELETE",
|
|
815
|
+
url: `${this.path}/${metadataId}/entries/${entryId}`
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Get entry by ID
|
|
820
|
+
*/
|
|
821
|
+
async getEntryById(metadataId, entryId) {
|
|
822
|
+
return this.request({
|
|
823
|
+
method: "GET",
|
|
824
|
+
url: `${this.path}/${metadataId}/entries/${entryId}`
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
|
|
829
|
+
// src/resources/admin/seo.ts
|
|
830
|
+
var SEOResource = class extends BaseResource {
|
|
831
|
+
constructor(httpClient, path = "/api/admin/seo") {
|
|
832
|
+
super(httpClient);
|
|
833
|
+
this.path = path;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* SEO doğrulama durumunu getirir (Validates listesi)
|
|
837
|
+
*/
|
|
838
|
+
async getValidation() {
|
|
839
|
+
return this.request({ method: "GET", url: this.path });
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Site ayarlarını getirir (UtilityController üzerinden)
|
|
843
|
+
*/
|
|
844
|
+
async getSettings(languageCode = "en") {
|
|
845
|
+
return this.request({
|
|
846
|
+
method: "GET",
|
|
847
|
+
url: "/api/settings",
|
|
848
|
+
params: { languageCode }
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Site ayarlarını günceller (UtilityController üzerinden)
|
|
853
|
+
*/
|
|
854
|
+
async updateSettings(data) {
|
|
855
|
+
return this.request({ method: "POST", url: "/api/settings/update", data });
|
|
856
|
+
}
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
// src/resources/admin/store.ts
|
|
860
|
+
var storeColumns = (...cols) => cols;
|
|
861
|
+
var StoreResource = class extends CrudResource {
|
|
862
|
+
constructor(httpClient, path = "/api/admin/store") {
|
|
863
|
+
super(httpClient, path);
|
|
864
|
+
}
|
|
865
|
+
async getStore() {
|
|
866
|
+
return this.request({
|
|
867
|
+
method: "GET",
|
|
868
|
+
url: this.path
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
async getStoreGraph(body) {
|
|
872
|
+
return this.request({
|
|
873
|
+
method: "POST",
|
|
874
|
+
url: `${this.path}/graph`,
|
|
875
|
+
data: body
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
async updateStore(data) {
|
|
879
|
+
return this.request({
|
|
880
|
+
method: "PUT",
|
|
881
|
+
url: this.path,
|
|
882
|
+
data
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
// src/resources/admin/content.ts
|
|
888
|
+
var contentColumns = (...cols) => cols;
|
|
889
|
+
var ContentResource = class extends CrudResource {
|
|
890
|
+
constructor(httpClient, path = "/api/admin/contents") {
|
|
891
|
+
super(httpClient, path);
|
|
892
|
+
}
|
|
893
|
+
/** @deprecated Use edit(id, data) instead */
|
|
894
|
+
async updateById(id, data) {
|
|
895
|
+
return this.edit(id, data);
|
|
896
|
+
}
|
|
897
|
+
async getLinking(id) {
|
|
898
|
+
return this.request({
|
|
899
|
+
method: "GET",
|
|
900
|
+
url: `${this.path}/${id}/linking`
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
async updateLinking(id, data) {
|
|
904
|
+
return this.request({
|
|
905
|
+
method: "PUT",
|
|
906
|
+
url: `${this.path}/${id}/linking`,
|
|
907
|
+
data
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
async getTranslate(id, source) {
|
|
911
|
+
return this.request({
|
|
912
|
+
method: "GET",
|
|
913
|
+
url: `${this.path}/${id}/translate`,
|
|
914
|
+
params: { source }
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
async updateTranslate(id, data) {
|
|
918
|
+
return this.request({
|
|
919
|
+
method: "PUT",
|
|
920
|
+
url: `${this.path}/${id}/translate`,
|
|
921
|
+
data
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
async getVariants(id) {
|
|
925
|
+
return this.request({
|
|
926
|
+
method: "GET",
|
|
927
|
+
url: `${this.path}/${id}/variants`
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
async updateVariants(id, data) {
|
|
931
|
+
return this.request({
|
|
932
|
+
method: "PUT",
|
|
933
|
+
url: `${this.path}/${id}/variants`,
|
|
934
|
+
data
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
async updateCustomData(id, data) {
|
|
938
|
+
return this.request({
|
|
939
|
+
method: "PUT",
|
|
940
|
+
url: `${this.path}/${id}/customdata`,
|
|
941
|
+
data
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
async getImportSchema() {
|
|
945
|
+
return this.request({
|
|
946
|
+
method: "GET",
|
|
947
|
+
url: `${this.path}/import`
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
async bulkImport(data) {
|
|
951
|
+
return this.request({
|
|
952
|
+
method: "POST",
|
|
953
|
+
url: `${this.path}/import`,
|
|
954
|
+
data
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
async createMockData() {
|
|
958
|
+
return this.request({
|
|
959
|
+
method: "GET",
|
|
960
|
+
url: `${this.path}/mock`
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
|
|
965
|
+
// src/resources/admin/collection.ts
|
|
966
|
+
var collectionColumns = (...cols) => cols;
|
|
967
|
+
var CollectionResource = class extends CrudResource {
|
|
968
|
+
constructor(httpClient, path = "/api/admin/collections") {
|
|
969
|
+
super(httpClient, path);
|
|
970
|
+
}
|
|
971
|
+
/** @deprecated Use edit(id, data) instead */
|
|
972
|
+
async updateById(id, data) {
|
|
973
|
+
return this.edit(id, data);
|
|
974
|
+
}
|
|
975
|
+
async getTranslate(id, source) {
|
|
976
|
+
return this.request({
|
|
977
|
+
method: "GET",
|
|
978
|
+
url: `${this.path}/${id}/translate`,
|
|
979
|
+
params: { source }
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
async updateTranslate(id, data) {
|
|
983
|
+
return this.request({
|
|
984
|
+
method: "PUT",
|
|
985
|
+
url: `${this.path}/${id}/translate`,
|
|
986
|
+
data
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
async bulkImport(data) {
|
|
990
|
+
return this.request({
|
|
991
|
+
method: "POST",
|
|
992
|
+
url: `${this.path}/import`,
|
|
993
|
+
data
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
// src/resources/admin/navigation.ts
|
|
999
|
+
var navigationColumns = (...cols) => cols;
|
|
1000
|
+
var NavigationResource = class extends CrudResource {
|
|
1001
|
+
constructor(httpClient, path = "/api/admin/navigations") {
|
|
1002
|
+
super(httpClient, path);
|
|
1003
|
+
}
|
|
1004
|
+
async getItems(navigationId) {
|
|
1005
|
+
return this.request({
|
|
1006
|
+
method: "GET",
|
|
1007
|
+
url: `${this.path}/${navigationId}/items`
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
async createItem(navigationId, data) {
|
|
1011
|
+
return this.request({
|
|
1012
|
+
method: "POST",
|
|
1013
|
+
url: `${this.path}/${navigationId}/items`,
|
|
1014
|
+
data
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
async updateItemsOrder(navigationId, items) {
|
|
1018
|
+
return this.request({
|
|
1019
|
+
method: "PATCH",
|
|
1020
|
+
url: `${this.path}/${navigationId}/items`,
|
|
1021
|
+
data: { items }
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
async updateItem(itemId, data) {
|
|
1025
|
+
return this.request({
|
|
1026
|
+
method: "PUT",
|
|
1027
|
+
url: `${this.path}/items/${itemId}`,
|
|
1028
|
+
data
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
async getItemById(itemId) {
|
|
1032
|
+
return this.request({
|
|
1033
|
+
method: "GET",
|
|
1034
|
+
url: `${this.path}/items/${itemId}`
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
async deleteItem(itemId) {
|
|
1038
|
+
return this.request({
|
|
1039
|
+
method: "DELETE",
|
|
1040
|
+
url: `${this.path}/items/${itemId}`
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
async getTranslate(id, source) {
|
|
1044
|
+
return this.request({
|
|
1045
|
+
method: "GET",
|
|
1046
|
+
url: `${this.path}/${id}/translate`,
|
|
1047
|
+
params: { source }
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
async updateTranslate(id, data) {
|
|
1051
|
+
return this.request({
|
|
1052
|
+
method: "PUT",
|
|
1053
|
+
url: `${this.path}/${id}/translate`,
|
|
1054
|
+
data
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
// src/resources/admin/media.ts
|
|
1060
|
+
var MediaResource = class extends BaseResource {
|
|
1061
|
+
path = "/api/admin/media";
|
|
1062
|
+
constructor(httpClient, path) {
|
|
1063
|
+
super(httpClient);
|
|
1064
|
+
if (path) this.path = path;
|
|
1065
|
+
}
|
|
1066
|
+
async getAll() {
|
|
1067
|
+
return this.request({
|
|
1068
|
+
method: "GET",
|
|
1069
|
+
url: this.path
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
async create(data) {
|
|
1073
|
+
return this.request({
|
|
1074
|
+
method: "POST",
|
|
1075
|
+
url: this.path,
|
|
1076
|
+
data
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
async getById(mediaId) {
|
|
1080
|
+
return this.request({
|
|
1081
|
+
method: "GET",
|
|
1082
|
+
url: `${this.path}/${mediaId}`
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
/** Cloudflare-style: delete resource by ID */
|
|
1086
|
+
async deleteById(mediaId) {
|
|
1087
|
+
await this.request({
|
|
1088
|
+
method: "DELETE",
|
|
1089
|
+
url: `${this.path}/${mediaId}`
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
/** @deprecated Use deleteById(id) instead */
|
|
1093
|
+
async delete(mediaId) {
|
|
1094
|
+
await this.deleteById(mediaId);
|
|
1095
|
+
return { data: null };
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1098
|
+
|
|
1099
|
+
// src/resources/admin/language.ts
|
|
1100
|
+
var languageColumns = (...cols) => cols;
|
|
1101
|
+
var LanguageResource = class extends CrudResource {
|
|
1102
|
+
constructor(httpClient, path = "/api/admin/languages") {
|
|
1103
|
+
super(httpClient, path);
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Get default language
|
|
1107
|
+
*/
|
|
1108
|
+
async getDefault() {
|
|
1109
|
+
return this.request({
|
|
1110
|
+
method: "GET",
|
|
1111
|
+
url: `${this.path}/default-language`
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1116
|
+
// src/resources/admin/auth.ts
|
|
1117
|
+
var AuthResource = class extends BaseResource {
|
|
1118
|
+
path = "/api/auth";
|
|
1119
|
+
constructor(httpClient, path) {
|
|
1120
|
+
super(httpClient);
|
|
1121
|
+
if (path) this.path = path;
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Email/Password ile giriş (Web - Cookie based)
|
|
1125
|
+
*/
|
|
1126
|
+
async signInEmail(input) {
|
|
1127
|
+
return this.request({
|
|
1128
|
+
method: "POST",
|
|
1129
|
+
url: `${this.path}/sign-in/email`,
|
|
1130
|
+
data: input
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Email/Password ile kayıt (Web - Cookie based)
|
|
1135
|
+
*/
|
|
1136
|
+
async signUpEmail(input) {
|
|
1137
|
+
return this.request({
|
|
1138
|
+
method: "POST",
|
|
1139
|
+
url: `${this.path}/sign-up/email`,
|
|
1140
|
+
data: input
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Mobil Uygulama Login (Token based)
|
|
1145
|
+
* Bu metod, SDK kullanımı için en uygun olanıdır.
|
|
1146
|
+
*/
|
|
1147
|
+
async mobileLogin(input) {
|
|
1148
|
+
return this.request({
|
|
1149
|
+
method: "POST",
|
|
1150
|
+
url: `${this.path}/mobile/login`,
|
|
1151
|
+
data: input
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Mobil Token Yenileme
|
|
1156
|
+
*/
|
|
1157
|
+
async mobileRefresh(token) {
|
|
1158
|
+
return this.request({
|
|
1159
|
+
method: "POST",
|
|
1160
|
+
url: `${this.path}/mobile/refresh`,
|
|
1161
|
+
data: { token }
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Mobil Token Doğrulama
|
|
1166
|
+
*/
|
|
1167
|
+
async mobileValidate() {
|
|
1168
|
+
return this.request({
|
|
1169
|
+
method: "GET",
|
|
1170
|
+
url: `${this.path}/mobile/validate`
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Mevcut session bilgisini getirir
|
|
1175
|
+
*/
|
|
1176
|
+
async getSession() {
|
|
1177
|
+
return this.request({
|
|
1178
|
+
method: "GET",
|
|
1179
|
+
url: `${this.path}/session`
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Çıkış yap (Backend: POST /api/auth/logout)
|
|
1184
|
+
*/
|
|
1185
|
+
async signOut() {
|
|
1186
|
+
return this.request({
|
|
1187
|
+
method: "POST",
|
|
1188
|
+
url: `${this.path}/sign-out`
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* Logout - invalidate session on backend (Backend: POST /api/auth/logout)
|
|
1193
|
+
*/
|
|
1194
|
+
async logout() {
|
|
1195
|
+
return this.request({
|
|
1196
|
+
method: "POST",
|
|
1197
|
+
url: `${this.path}/logout`
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1202
|
+
// src/resources/admin/google.ts
|
|
1203
|
+
var GoogleResource = class extends BaseResource {
|
|
1204
|
+
constructor(httpClient) {
|
|
1205
|
+
super(httpClient);
|
|
1206
|
+
}
|
|
1207
|
+
async getSites() {
|
|
1208
|
+
return this.request({
|
|
1209
|
+
method: "GET",
|
|
1210
|
+
url: "/api/admin/google"
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
async getAnalytics(propertyId) {
|
|
1214
|
+
return this.request({
|
|
1215
|
+
method: "GET",
|
|
1216
|
+
url: "/api/admin/google/analytics",
|
|
1217
|
+
params: { propertyId }
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
async updateSitemap(siteUrl, sitemapUrl) {
|
|
1221
|
+
return this.request({
|
|
1222
|
+
method: "PUT",
|
|
1223
|
+
url: "/api/admin/google/webconsole",
|
|
1224
|
+
data: { siteUrl, sitemapUrl }
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
async getPerformance(siteUrl, startDate, endDate) {
|
|
1228
|
+
return this.request({
|
|
1229
|
+
method: "GET",
|
|
1230
|
+
url: "/api/admin/google/performance",
|
|
1231
|
+
params: { siteUrl, startDate, endDate }
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
async connectGoogleAnalytics(data) {
|
|
1235
|
+
return this.request({
|
|
1236
|
+
method: "POST",
|
|
1237
|
+
url: "/api/admin/google/connect",
|
|
1238
|
+
data
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
async getAnalyticsAccount() {
|
|
1242
|
+
return this.request({
|
|
1243
|
+
method: "GET",
|
|
1244
|
+
url: "/api/admin/google/analytics/account"
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
async getAnalyticsAccountDetails(acc) {
|
|
1248
|
+
return this.request({
|
|
1249
|
+
method: "GET",
|
|
1250
|
+
url: `/api/admin/google/analytics/account/${acc}`
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
async getDetailedAnalytics(acc, propertyId, reportType) {
|
|
1254
|
+
return this.request({
|
|
1255
|
+
method: "POST",
|
|
1256
|
+
url: `/api/admin/google/analytics/account/${acc}`,
|
|
1257
|
+
data: { propertyId, reportType }
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
|
|
1262
|
+
// src/resources/admin/cloudflare.ts
|
|
1263
|
+
var CloudflareResource = class extends BaseResource {
|
|
1264
|
+
constructor(httpClient) {
|
|
1265
|
+
super(httpClient);
|
|
1266
|
+
}
|
|
1267
|
+
async getAccounts() {
|
|
1268
|
+
return this.request({
|
|
1269
|
+
method: "GET",
|
|
1270
|
+
url: "/api/admin/cloudflare"
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
async getZones(verified) {
|
|
1274
|
+
return this.request({
|
|
1275
|
+
method: "GET",
|
|
1276
|
+
url: "/api/admin/cloudflare/zones",
|
|
1277
|
+
params: { verified }
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
async getZonesSelect() {
|
|
1281
|
+
return this.request({
|
|
1282
|
+
method: "GET",
|
|
1283
|
+
url: "/api/admin/cloudflare/zones/select"
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1286
|
+
async createZone(domain, openProviderData) {
|
|
1287
|
+
return this.request({
|
|
1288
|
+
method: "POST",
|
|
1289
|
+
url: "/api/admin/cloudflare/zones/new",
|
|
1290
|
+
data: { domain, ...openProviderData && { openProviderData } }
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
async getZoneById(zoneId) {
|
|
1294
|
+
return this.request({
|
|
1295
|
+
method: "GET",
|
|
1296
|
+
url: `/api/admin/cloudflare/zones/${zoneId}`
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
async createDnsRecord(zoneId, data) {
|
|
1300
|
+
return this.request({
|
|
1301
|
+
method: "POST",
|
|
1302
|
+
url: `/api/admin/cloudflare/zones/${zoneId}`,
|
|
1303
|
+
data
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
async updateDnsRecord(zoneId, data) {
|
|
1307
|
+
return this.request({
|
|
1308
|
+
method: "PUT",
|
|
1309
|
+
url: `/api/admin/cloudflare/zones/${zoneId}`,
|
|
1310
|
+
data
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
async deleteDnsRecord(zoneId, dnsId) {
|
|
1314
|
+
return this.request({
|
|
1315
|
+
method: "DELETE",
|
|
1316
|
+
url: `/api/admin/cloudflare/zones/${zoneId}`,
|
|
1317
|
+
data: { dnsId }
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
async submitSitemap() {
|
|
1321
|
+
return this.request({
|
|
1322
|
+
method: "POST",
|
|
1323
|
+
url: "/api/admin/cloudflare/zones/sitemap"
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
async checkZone(zoneId) {
|
|
1327
|
+
return this.request({
|
|
1328
|
+
method: "GET",
|
|
1329
|
+
url: `/api/admin/cloudflare/zones/${zoneId}/check`
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
async getAccountById(accountId) {
|
|
1333
|
+
return this.request({
|
|
1334
|
+
method: "GET",
|
|
1335
|
+
url: `/api/admin/cloudflare/accounts/${accountId}`
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
async fixWebmasterVerify() {
|
|
1339
|
+
return this.request({
|
|
1340
|
+
method: "POST",
|
|
1341
|
+
url: "/api/admin/cloudflare/zones/fix-webmaster-verify"
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
async searchDomains(query) {
|
|
1345
|
+
return this.request({
|
|
1346
|
+
method: "GET",
|
|
1347
|
+
url: "/api/admin/cloudflare/zones/buy",
|
|
1348
|
+
params: { q: query }
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
async buyDomain(data) {
|
|
1352
|
+
return this.request({
|
|
1353
|
+
method: "POST",
|
|
1354
|
+
url: "/api/admin/cloudflare/zones/buy",
|
|
1355
|
+
data
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
|
|
1360
|
+
// src/resources/admin/review.ts
|
|
1361
|
+
var ReviewResource = class extends CrudResource {
|
|
1362
|
+
constructor(httpClient) {
|
|
1363
|
+
super(httpClient, "/api/admin/contents/reviews");
|
|
1364
|
+
}
|
|
1365
|
+
async getReviews(params) {
|
|
1366
|
+
return this.request({
|
|
1367
|
+
method: "GET",
|
|
1368
|
+
url: this.path,
|
|
1369
|
+
params
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
// src/resources/admin/custom-data.ts
|
|
1375
|
+
var CustomDataResource = class extends BaseResource {
|
|
1376
|
+
constructor(httpClient) {
|
|
1377
|
+
super(httpClient);
|
|
1378
|
+
}
|
|
1379
|
+
async getAll(scope) {
|
|
1380
|
+
return this.request({
|
|
1381
|
+
method: "GET",
|
|
1382
|
+
url: `/api/admin/custom_data/${scope}`
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
async create(scope, data) {
|
|
1386
|
+
return this.request({
|
|
1387
|
+
method: "POST",
|
|
1388
|
+
url: `/api/admin/custom_data/${scope}`,
|
|
1389
|
+
data
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
async getById(scope, id) {
|
|
1393
|
+
return this.request({
|
|
1394
|
+
method: "GET",
|
|
1395
|
+
url: `/api/admin/custom_data/${scope}/${id}`
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
async update(scope, id, data) {
|
|
1399
|
+
return this.request({
|
|
1400
|
+
method: "PUT",
|
|
1401
|
+
url: `/api/admin/custom_data/${scope}/${id}`,
|
|
1402
|
+
data
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
async delete(scope, id) {
|
|
1406
|
+
return this.request({
|
|
1407
|
+
method: "DELETE",
|
|
1408
|
+
url: `/api/admin/custom_data/${scope}/${id}`
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
async getForm(scope, type) {
|
|
1412
|
+
return this.request({
|
|
1413
|
+
method: "GET",
|
|
1414
|
+
url: `/api/admin/custom_data/form/${scope}/${type}`
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
async getFormVariants(scope, categoryId) {
|
|
1418
|
+
return this.request({
|
|
1419
|
+
method: "GET",
|
|
1420
|
+
url: `/api/admin/custom_data/form/${scope}/variants/${categoryId}`
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
};
|
|
1424
|
+
|
|
1425
|
+
// src/resources/admin/project.ts
|
|
1426
|
+
var projectColumns = (...cols) => cols;
|
|
1427
|
+
var ProjectResource = class extends CrudResource {
|
|
1428
|
+
constructor(httpClient) {
|
|
1429
|
+
super(httpClient, "/api/admin/projects");
|
|
1430
|
+
}
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1433
|
+
// src/resources/admin/sector.ts
|
|
1434
|
+
var sectorColumns = (...cols) => cols;
|
|
1435
|
+
var SectorResource = class extends CrudResource {
|
|
1436
|
+
constructor(httpClient) {
|
|
1437
|
+
super(httpClient, "/api/admin/sectors");
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
|
|
1441
|
+
// src/resources/admin/webmail.ts
|
|
1442
|
+
var WebmailResource = class extends BaseResource {
|
|
1443
|
+
constructor(httpClient) {
|
|
1444
|
+
super(httpClient);
|
|
1445
|
+
}
|
|
1446
|
+
async getWebmail() {
|
|
1447
|
+
return this.request({
|
|
1448
|
+
method: "GET",
|
|
1449
|
+
url: "/api/admin/webmail"
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
async getMailboxes(email) {
|
|
1453
|
+
return this.request({
|
|
1454
|
+
method: "GET",
|
|
1455
|
+
url: "/api/admin/webmail/mail",
|
|
1456
|
+
params: { email }
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
async createMailbox(data) {
|
|
1460
|
+
return this.request({
|
|
1461
|
+
method: "POST",
|
|
1462
|
+
url: "/api/admin/webmail/mail",
|
|
1463
|
+
data
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
async updateMailbox(data) {
|
|
1467
|
+
return this.request({
|
|
1468
|
+
method: "PUT",
|
|
1469
|
+
url: "/api/admin/webmail/mail",
|
|
1470
|
+
data
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
async deleteMailbox(email) {
|
|
1474
|
+
return this.request({
|
|
1475
|
+
method: "DELETE",
|
|
1476
|
+
url: "/api/admin/webmail/mail",
|
|
1477
|
+
params: { email }
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1482
|
+
// src/resources/admin/subscription.ts
|
|
1483
|
+
var SubscriptionResource = class extends BaseResource {
|
|
1484
|
+
constructor(httpClient) {
|
|
1485
|
+
super(httpClient);
|
|
1486
|
+
}
|
|
1487
|
+
async getPackages(category) {
|
|
1488
|
+
return this.request({
|
|
1489
|
+
method: "GET",
|
|
1490
|
+
url: "/api/admin/subscribe",
|
|
1491
|
+
params: { category }
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
async subscribe(data) {
|
|
1495
|
+
return this.request({
|
|
1496
|
+
method: "POST",
|
|
1497
|
+
url: "/api/admin/subscribe",
|
|
1498
|
+
data
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
async getCurrentSubscription() {
|
|
1502
|
+
return this.request({
|
|
1503
|
+
method: "GET",
|
|
1504
|
+
url: "/api/admin/subscribe/me"
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
async cancelSubscription(id) {
|
|
1508
|
+
return this.request({
|
|
1509
|
+
method: "POST",
|
|
1510
|
+
url: "/api/admin/subscribe/me/cancel",
|
|
1511
|
+
data: { id }
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
async upgradeSubscription(data) {
|
|
1515
|
+
return this.request({
|
|
1516
|
+
method: "POST",
|
|
1517
|
+
url: "/api/admin/subscribe/upgrade",
|
|
1518
|
+
data
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
async retrySubscription(data) {
|
|
1522
|
+
return this.request({
|
|
1523
|
+
method: "POST",
|
|
1524
|
+
url: "/api/admin/subscribe/retry",
|
|
1525
|
+
data
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
async getBilling() {
|
|
1529
|
+
return this.request({
|
|
1530
|
+
method: "GET",
|
|
1531
|
+
url: "/api/admin/subscribe/billing"
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
async validateSubscription() {
|
|
1535
|
+
return this.request({
|
|
1536
|
+
method: "GET",
|
|
1537
|
+
url: "/api/admin/subscribe/validate"
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
};
|
|
1541
|
+
|
|
1542
|
+
// src/resources/admin/purchase.ts
|
|
1543
|
+
var PurchaseResource = class extends BaseResource {
|
|
1544
|
+
constructor(httpClient) {
|
|
1545
|
+
super(httpClient);
|
|
1546
|
+
}
|
|
1547
|
+
async getPurchases() {
|
|
1548
|
+
return this.request({
|
|
1549
|
+
method: "GET",
|
|
1550
|
+
url: "/api/admin/purchase"
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
async createPurchase(data) {
|
|
1554
|
+
return this.request({
|
|
1555
|
+
method: "POST",
|
|
1556
|
+
url: "/api/admin/purchase",
|
|
1557
|
+
data
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1562
|
+
// src/resources/frontstore/index.ts
|
|
1563
|
+
var frontstore_exports = {};
|
|
1564
|
+
__export(frontstore_exports, {
|
|
1565
|
+
CollectionResource: () => CollectionResource2,
|
|
1566
|
+
ContentResource: () => ContentResource2,
|
|
1567
|
+
ContentTypesResource: () => ContentTypesResource,
|
|
1568
|
+
FavoriteResource: () => FavoriteResource,
|
|
1569
|
+
LanguageResource: () => LanguageResource2,
|
|
1570
|
+
MediaResource: () => MediaResource2,
|
|
1571
|
+
NavigationResource: () => NavigationResource2,
|
|
1572
|
+
PageLayoutResource: () => PageLayoutResource,
|
|
1573
|
+
ReviewResource: () => ReviewResource2,
|
|
1574
|
+
ShopResource: () => ShopResource,
|
|
1575
|
+
SlugsResource: () => SlugsResource,
|
|
1576
|
+
StoreResource: () => StoreResource2,
|
|
1577
|
+
UserResource: () => UserResource,
|
|
1578
|
+
UtilityResource: () => UtilityResource,
|
|
1579
|
+
collectionColumns: () => collectionColumns2,
|
|
1580
|
+
contentColumns: () => contentColumns2
|
|
1581
|
+
});
|
|
1582
|
+
|
|
1583
|
+
// src/resources/frontstore/store.ts
|
|
1584
|
+
var StoreResource2 = class extends CrudResource {
|
|
1585
|
+
constructor(httpClient, path = "/api/store") {
|
|
1586
|
+
super(httpClient, path);
|
|
1587
|
+
}
|
|
1588
|
+
async getBySlug(slug) {
|
|
1589
|
+
const response = await this.findMany({ where: { slug, isActive: true }, take: 1 });
|
|
1590
|
+
return response.data.length > 0 ? response.data[0] : null;
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
// src/resources/frontstore/content.ts
|
|
1595
|
+
var contentColumns2 = (...cols) => cols;
|
|
1596
|
+
var ContentResource2 = class extends CrudResource {
|
|
1597
|
+
constructor(httpClient, path = "/api/content") {
|
|
1598
|
+
super(httpClient, path);
|
|
1599
|
+
}
|
|
1600
|
+
async getByCollection(collectionId) {
|
|
1601
|
+
return this.list({
|
|
1602
|
+
filter: { collectionId, isActive: true },
|
|
1603
|
+
sort: "order:asc",
|
|
1604
|
+
paginate: { page: 1, limit: 50 }
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
async getByScope(scope, query) {
|
|
1608
|
+
return this.request({
|
|
1609
|
+
method: "POST",
|
|
1610
|
+
url: `${this.path}/${scope}`,
|
|
1611
|
+
data: query || {}
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
async getByIdByScope(scope, id, query) {
|
|
1615
|
+
return this.request({
|
|
1616
|
+
method: "POST",
|
|
1617
|
+
url: `${this.path}/${scope}/${id}`,
|
|
1618
|
+
data: query || {}
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
// src/resources/frontstore/collection.ts
|
|
1624
|
+
var collectionColumns2 = (...cols) => cols;
|
|
1625
|
+
var CollectionResource2 = class extends CrudResource {
|
|
1626
|
+
constructor(httpClient, path = "/api/collections") {
|
|
1627
|
+
super(httpClient, path);
|
|
1628
|
+
}
|
|
1629
|
+
async getByStore(storeId) {
|
|
1630
|
+
return this.list({
|
|
1631
|
+
filter: { storeId, isActive: true },
|
|
1632
|
+
sort: "order:asc"
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1635
|
+
async getByScope(scope, query) {
|
|
1636
|
+
return this.request({
|
|
1637
|
+
method: "POST",
|
|
1638
|
+
url: `${this.path}/${scope}`,
|
|
1639
|
+
data: query || {}
|
|
1640
|
+
});
|
|
1641
|
+
}
|
|
1642
|
+
async getFilters(scope, filters, language = "en-gb", parentId) {
|
|
1643
|
+
return this.request({
|
|
1644
|
+
method: "POST",
|
|
1645
|
+
url: `${this.path}/${scope}/filters`,
|
|
1646
|
+
params: { language },
|
|
1647
|
+
data: { filters, parentId }
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1651
|
+
|
|
1652
|
+
// src/resources/frontstore/navigation.ts
|
|
1653
|
+
var NavigationResource2 = class extends CrudResource {
|
|
1654
|
+
constructor(httpClient, path = "/api/navigation") {
|
|
1655
|
+
super(httpClient, path);
|
|
1656
|
+
}
|
|
1657
|
+
async getItems(navigationId) {
|
|
1658
|
+
return this.request({
|
|
1659
|
+
method: "GET",
|
|
1660
|
+
url: `${this.path}/${navigationId}/items`
|
|
1661
|
+
});
|
|
1662
|
+
}
|
|
1663
|
+
};
|
|
1664
|
+
|
|
1665
|
+
// src/resources/frontstore/media.ts
|
|
1666
|
+
var MediaResource2 = class extends CrudResource {
|
|
1667
|
+
constructor(httpClient, path = "/api/media") {
|
|
1668
|
+
super(httpClient, path);
|
|
1669
|
+
}
|
|
1670
|
+
};
|
|
1671
|
+
|
|
1672
|
+
// src/resources/frontstore/user.ts
|
|
1673
|
+
var UserResource = class extends CrudResource {
|
|
1674
|
+
constructor(httpClient, path = "/api/user") {
|
|
1675
|
+
super(httpClient, path);
|
|
1676
|
+
}
|
|
1677
|
+
async me() {
|
|
1678
|
+
return this.request({ method: "GET", url: `${this.path}/me` });
|
|
1679
|
+
}
|
|
1680
|
+
};
|
|
1681
|
+
|
|
1682
|
+
// src/resources/frontstore/shop.ts
|
|
1683
|
+
var ShopResource = class extends BaseResource {
|
|
1684
|
+
constructor(httpClient) {
|
|
1685
|
+
super(httpClient);
|
|
1686
|
+
}
|
|
1687
|
+
// Products
|
|
1688
|
+
async getProducts(params) {
|
|
1689
|
+
return this.request({
|
|
1690
|
+
method: "GET",
|
|
1691
|
+
url: "/api/shop/products",
|
|
1692
|
+
params
|
|
1693
|
+
});
|
|
1694
|
+
}
|
|
1695
|
+
async getProduct(id) {
|
|
1696
|
+
return this.request({
|
|
1697
|
+
method: "GET",
|
|
1698
|
+
url: `/api/shop/products/${id}`
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
// Cart
|
|
1702
|
+
async createCart(data) {
|
|
1703
|
+
return this.request({
|
|
1704
|
+
method: "POST",
|
|
1705
|
+
url: "/api/shop/cart",
|
|
1706
|
+
data
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
async getCart(id) {
|
|
1710
|
+
return this.request({
|
|
1711
|
+
method: "GET",
|
|
1712
|
+
url: `/api/shop/cart/${id}`
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
async updateCart(id, data) {
|
|
1716
|
+
return this.request({
|
|
1717
|
+
method: "POST",
|
|
1718
|
+
url: `/api/shop/cart/${id}`,
|
|
1719
|
+
data
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
async addLineItem(cartId, data) {
|
|
1723
|
+
return this.request({
|
|
1724
|
+
method: "POST",
|
|
1725
|
+
url: `/api/shop/cart/${cartId}/line-items`,
|
|
1726
|
+
data
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
async updateLineItem(cartId, lineId, data) {
|
|
1730
|
+
return this.request({
|
|
1731
|
+
method: "POST",
|
|
1732
|
+
url: `/api/shop/cart/${cartId}/line-items/${lineId}`,
|
|
1733
|
+
data
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
async removeLineItem(cartId, lineId) {
|
|
1737
|
+
return this.request({
|
|
1738
|
+
method: "DELETE",
|
|
1739
|
+
url: `/api/shop/cart/${cartId}/line-items/${lineId}`
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
async completeCart(cartId) {
|
|
1743
|
+
return this.request({
|
|
1744
|
+
method: "POST",
|
|
1745
|
+
url: `/api/shop/cart/${cartId}/complete`
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1748
|
+
// Orders
|
|
1749
|
+
async getMyOrders(params) {
|
|
1750
|
+
return this.request({
|
|
1751
|
+
method: "GET",
|
|
1752
|
+
url: "/api/shop/orders/me",
|
|
1753
|
+
params
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
async getOrder(id) {
|
|
1757
|
+
return this.request({
|
|
1758
|
+
method: "GET",
|
|
1759
|
+
url: `/api/shop/orders/${id}`
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
// Checkout & Card Storage
|
|
1763
|
+
async createPaymentLink(data) {
|
|
1764
|
+
return this.request({
|
|
1765
|
+
method: "POST",
|
|
1766
|
+
url: "/api/shop/checkout/payment",
|
|
1767
|
+
data
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
async handlePaymentCallback(data) {
|
|
1771
|
+
return this.request({
|
|
1772
|
+
method: "POST",
|
|
1773
|
+
url: "/api/shop/checkout/callback",
|
|
1774
|
+
data
|
|
1775
|
+
});
|
|
1776
|
+
}
|
|
1777
|
+
async getInstallments(data) {
|
|
1778
|
+
return this.request({
|
|
1779
|
+
method: "POST",
|
|
1780
|
+
url: "/api/shop/checkout/payment/installment",
|
|
1781
|
+
data
|
|
1782
|
+
});
|
|
1783
|
+
}
|
|
1784
|
+
async getCards() {
|
|
1785
|
+
return this.request({
|
|
1786
|
+
method: "GET",
|
|
1787
|
+
url: "/api/shop/checkout/card-storage"
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
async saveCard(data) {
|
|
1791
|
+
return this.request({
|
|
1792
|
+
method: "POST",
|
|
1793
|
+
url: "/api/shop/checkout/card-storage",
|
|
1794
|
+
data
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
async deleteCard(cardToken) {
|
|
1798
|
+
return this.request({
|
|
1799
|
+
method: "DELETE",
|
|
1800
|
+
url: "/api/shop/checkout/card-storage",
|
|
1801
|
+
data: { cardToken }
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
};
|
|
1805
|
+
|
|
1806
|
+
// src/resources/frontstore/utility.ts
|
|
1807
|
+
var UtilityResource = class extends BaseResource {
|
|
1808
|
+
constructor(httpClient) {
|
|
1809
|
+
super(httpClient);
|
|
1810
|
+
}
|
|
1811
|
+
async search(query, language = "en") {
|
|
1812
|
+
return this.request({
|
|
1813
|
+
method: "GET",
|
|
1814
|
+
url: "/api/search",
|
|
1815
|
+
params: { q: query, lang: language }
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
async getRfqs(userId) {
|
|
1819
|
+
return this.request({
|
|
1820
|
+
method: "GET",
|
|
1821
|
+
url: "/api/rfq",
|
|
1822
|
+
headers: { "x-user-id": userId }
|
|
1823
|
+
});
|
|
1824
|
+
}
|
|
1825
|
+
async getRfqById(userId, id) {
|
|
1826
|
+
return this.request({
|
|
1827
|
+
method: "GET",
|
|
1828
|
+
url: `/api/rfq/${id}`,
|
|
1829
|
+
headers: { "x-user-id": userId }
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
async createRfq(userId, data) {
|
|
1833
|
+
return this.request({
|
|
1834
|
+
method: "POST",
|
|
1835
|
+
url: "/api/rfq",
|
|
1836
|
+
headers: { "x-user-id": userId },
|
|
1837
|
+
data
|
|
1838
|
+
});
|
|
1839
|
+
}
|
|
1840
|
+
async getSettings(languageCode = "en") {
|
|
1841
|
+
return this.request({
|
|
1842
|
+
method: "GET",
|
|
1843
|
+
url: "/api/settings",
|
|
1844
|
+
params: { languageCode }
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
async updateSettings(id, language, data) {
|
|
1848
|
+
return this.request({
|
|
1849
|
+
method: "POST",
|
|
1850
|
+
url: "/api/settings/update",
|
|
1851
|
+
data: { id, language, data }
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
async getRobots() {
|
|
1855
|
+
return this.request({
|
|
1856
|
+
method: "GET",
|
|
1857
|
+
url: "/api/robots"
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
async getSitemap() {
|
|
1861
|
+
return this.request({
|
|
1862
|
+
method: "GET",
|
|
1863
|
+
url: "/api/sitemap"
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
async getSitemapPart(scope, part, language = "en") {
|
|
1867
|
+
return this.request({
|
|
1868
|
+
method: "GET",
|
|
1869
|
+
url: `/api/sitemap/${scope}/${part}`,
|
|
1870
|
+
params: { language }
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
};
|
|
1874
|
+
|
|
1875
|
+
// src/resources/frontstore/favorite.ts
|
|
1876
|
+
var FavoriteResource = class extends BaseResource {
|
|
1877
|
+
constructor(httpClient) {
|
|
1878
|
+
super(httpClient);
|
|
1879
|
+
}
|
|
1880
|
+
async getFavorites(userId, language = "en") {
|
|
1881
|
+
return this.request({
|
|
1882
|
+
method: "GET",
|
|
1883
|
+
url: "/api/favorites",
|
|
1884
|
+
headers: { "x-user-id": userId },
|
|
1885
|
+
params: { language }
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
async addFavorite(userId, contentId) {
|
|
1889
|
+
return this.request({
|
|
1890
|
+
method: "POST",
|
|
1891
|
+
url: "/api/favorites",
|
|
1892
|
+
headers: { "x-user-id": userId },
|
|
1893
|
+
data: { id: contentId }
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
async removeFavorite(userId, id, contentId) {
|
|
1897
|
+
return this.request({
|
|
1898
|
+
method: "DELETE",
|
|
1899
|
+
url: "/api/favorites",
|
|
1900
|
+
headers: { "x-user-id": userId },
|
|
1901
|
+
params: id ? { id } : contentId ? { contentId } : {}
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
};
|
|
1905
|
+
|
|
1906
|
+
// src/resources/frontstore/language.ts
|
|
1907
|
+
var LanguageResource2 = class extends BaseResource {
|
|
1908
|
+
constructor(httpClient) {
|
|
1909
|
+
super(httpClient);
|
|
1910
|
+
}
|
|
1911
|
+
async getLanguages(includeInactive = false) {
|
|
1912
|
+
return this.request({
|
|
1913
|
+
method: "GET",
|
|
1914
|
+
url: "/api/languages",
|
|
1915
|
+
params: { includeInactive: includeInactive.toString() }
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
};
|
|
1919
|
+
|
|
1920
|
+
// src/resources/frontstore/layout.ts
|
|
1921
|
+
var PageLayoutResource = class extends CrudResource {
|
|
1922
|
+
constructor(httpClient) {
|
|
1923
|
+
super(httpClient, "/api/layouts");
|
|
1924
|
+
}
|
|
1925
|
+
async getById(id, contentId, preview = false) {
|
|
1926
|
+
return this.request({
|
|
1927
|
+
method: "GET",
|
|
1928
|
+
url: `${this.path}/${id}`,
|
|
1929
|
+
params: { contentId, preview }
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
|
|
1934
|
+
// src/resources/frontstore/content-types.ts
|
|
1935
|
+
var ContentTypesResource = class extends CrudResource {
|
|
1936
|
+
constructor(httpClient) {
|
|
1937
|
+
super(httpClient, "/api/content-types");
|
|
1938
|
+
}
|
|
1939
|
+
};
|
|
1940
|
+
|
|
1941
|
+
// src/resources/frontstore/review.ts
|
|
1942
|
+
var ReviewResource2 = class extends BaseResource {
|
|
1943
|
+
path = "/api/content/reviews";
|
|
1944
|
+
constructor(httpClient) {
|
|
1945
|
+
super(httpClient);
|
|
1946
|
+
}
|
|
1947
|
+
async getReviews(slug, page = 1, limit = 10, language = "en") {
|
|
1948
|
+
return this.request({
|
|
1949
|
+
method: "GET",
|
|
1950
|
+
url: `${this.path}/${slug}`,
|
|
1951
|
+
params: { page, limit, language }
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
async createReview(slug, userId, data) {
|
|
1955
|
+
return this.request({
|
|
1956
|
+
method: "POST",
|
|
1957
|
+
url: `${this.path}/${slug}`,
|
|
1958
|
+
headers: { "x-user-id": userId },
|
|
1959
|
+
data
|
|
1960
|
+
});
|
|
1961
|
+
}
|
|
1962
|
+
};
|
|
1963
|
+
|
|
1964
|
+
// src/resources/frontstore/slugs.ts
|
|
1965
|
+
var SlugsResource = class extends BaseResource {
|
|
1966
|
+
path = "/api/slugs";
|
|
1967
|
+
constructor(httpClient) {
|
|
1968
|
+
super(httpClient);
|
|
1969
|
+
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Get store settings by origin
|
|
1972
|
+
*/
|
|
1973
|
+
async getStore() {
|
|
1974
|
+
return this.request({
|
|
1975
|
+
method: "GET",
|
|
1976
|
+
url: this.path
|
|
1977
|
+
});
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* Get comprehensive page data based on slugs
|
|
1981
|
+
*/
|
|
1982
|
+
async getPageData(dto) {
|
|
1983
|
+
return this.request({
|
|
1984
|
+
method: "POST",
|
|
1985
|
+
url: this.path,
|
|
1986
|
+
data: dto
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
|
|
1991
|
+
// src/core/response.ts
|
|
1992
|
+
function unwrap(response, fallback) {
|
|
1993
|
+
if (response == null) return fallback;
|
|
1994
|
+
if (typeof response === "object" && "data" in response && response.data !== void 0) {
|
|
1995
|
+
const data = response.data;
|
|
1996
|
+
return data ?? fallback;
|
|
1997
|
+
}
|
|
1998
|
+
return response ?? fallback;
|
|
1999
|
+
}
|
|
2000
|
+
function unwrapList(response) {
|
|
2001
|
+
const data = unwrap(response, []);
|
|
2002
|
+
return Array.isArray(data) ? data : [];
|
|
2003
|
+
}
|
|
2004
|
+
function unwrapMeta(response) {
|
|
2005
|
+
if (!response || typeof response !== "object") return void 0;
|
|
2006
|
+
return response.meta;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
// src/types/admin/index.ts
|
|
2010
|
+
var admin_exports2 = {};
|
|
2011
|
+
|
|
2012
|
+
// src/types/frontstore/index.ts
|
|
2013
|
+
var frontstore_exports2 = {};
|
|
2014
|
+
|
|
2015
|
+
// src/types/common/index.ts
|
|
2016
|
+
var common_exports = {};
|
|
2017
|
+
|
|
2018
|
+
// src/types/schema/index.ts
|
|
2019
|
+
var schema_exports = {};
|
|
2020
|
+
__export(schema_exports, {
|
|
2021
|
+
columns: () => columns
|
|
2022
|
+
});
|
|
2023
|
+
|
|
2024
|
+
// src/types/schema/columns.ts
|
|
2025
|
+
function columns(...cols) {
|
|
2026
|
+
return cols;
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
// src/index.ts
|
|
2030
|
+
var AdminNamespace = class {
|
|
2031
|
+
vendors;
|
|
2032
|
+
contents;
|
|
2033
|
+
stores;
|
|
2034
|
+
collections;
|
|
2035
|
+
navigations;
|
|
2036
|
+
layouts;
|
|
2037
|
+
settings;
|
|
2038
|
+
apiKeys;
|
|
2039
|
+
media;
|
|
2040
|
+
languages;
|
|
2041
|
+
datasource;
|
|
2042
|
+
metadata;
|
|
2043
|
+
seo;
|
|
2044
|
+
auth;
|
|
2045
|
+
sections;
|
|
2046
|
+
themes;
|
|
2047
|
+
google;
|
|
2048
|
+
cloudflare;
|
|
2049
|
+
reviews;
|
|
2050
|
+
customData;
|
|
2051
|
+
projects;
|
|
2052
|
+
sectors;
|
|
2053
|
+
webmail;
|
|
2054
|
+
subscriptions;
|
|
2055
|
+
purchases;
|
|
2056
|
+
constructor(client) {
|
|
2057
|
+
this.vendors = new VendorResource(client.instance);
|
|
2058
|
+
this.contents = new ContentResource(client.instance);
|
|
2059
|
+
this.stores = new StoreResource(client.instance);
|
|
2060
|
+
this.collections = new CollectionResource(client.instance);
|
|
2061
|
+
this.navigations = new NavigationResource(client.instance);
|
|
2062
|
+
this.layouts = new LayoutResource(client.instance);
|
|
2063
|
+
this.settings = new SettingsResource(client.instance);
|
|
2064
|
+
this.apiKeys = new ApiKeyResource(client.instance);
|
|
2065
|
+
this.media = new MediaResource(client.instance);
|
|
2066
|
+
this.languages = new LanguageResource(client.instance);
|
|
2067
|
+
this.datasource = new DatasourceResource(client.instance);
|
|
2068
|
+
this.metadata = new MetadataResource(client.instance);
|
|
2069
|
+
this.seo = new SEOResource(client.instance);
|
|
2070
|
+
this.auth = new AuthResource(client.instance);
|
|
2071
|
+
this.sections = new SectionResource(client.instance);
|
|
2072
|
+
this.themes = new ThemeResource(client.instance);
|
|
2073
|
+
this.google = new GoogleResource(client.instance);
|
|
2074
|
+
this.cloudflare = new CloudflareResource(client.instance);
|
|
2075
|
+
this.reviews = new ReviewResource(client.instance);
|
|
2076
|
+
this.customData = new CustomDataResource(client.instance);
|
|
2077
|
+
this.projects = new ProjectResource(client.instance);
|
|
2078
|
+
this.sectors = new SectorResource(client.instance);
|
|
2079
|
+
this.webmail = new WebmailResource(client.instance);
|
|
2080
|
+
this.subscriptions = new SubscriptionResource(client.instance);
|
|
2081
|
+
this.purchases = new PurchaseResource(client.instance);
|
|
2082
|
+
}
|
|
2083
|
+
};
|
|
2084
|
+
var FrontstoreNamespace = class {
|
|
2085
|
+
store;
|
|
2086
|
+
collection;
|
|
2087
|
+
content;
|
|
2088
|
+
navigation;
|
|
2089
|
+
media;
|
|
2090
|
+
user;
|
|
2091
|
+
shop;
|
|
2092
|
+
utility;
|
|
2093
|
+
favorite;
|
|
2094
|
+
language;
|
|
2095
|
+
layouts;
|
|
2096
|
+
contentTypes;
|
|
2097
|
+
review;
|
|
2098
|
+
slugs;
|
|
2099
|
+
constructor(client) {
|
|
2100
|
+
this.store = new StoreResource2(client.instance);
|
|
2101
|
+
this.collection = new CollectionResource2(client.instance);
|
|
2102
|
+
this.content = new ContentResource2(client.instance);
|
|
2103
|
+
this.navigation = new NavigationResource2(client.instance);
|
|
2104
|
+
this.media = new MediaResource2(client.instance);
|
|
2105
|
+
this.user = new UserResource(client.instance);
|
|
2106
|
+
this.shop = new ShopResource(client.instance);
|
|
2107
|
+
this.utility = new UtilityResource(client.instance);
|
|
2108
|
+
this.favorite = new FavoriteResource(client.instance);
|
|
2109
|
+
this.language = new LanguageResource2(client.instance);
|
|
2110
|
+
this.layouts = new PageLayoutResource(client.instance);
|
|
2111
|
+
this.contentTypes = new ContentTypesResource(client.instance);
|
|
2112
|
+
this.review = new ReviewResource2(client.instance);
|
|
2113
|
+
this.slugs = new SlugsResource(client.instance);
|
|
2114
|
+
}
|
|
2115
|
+
};
|
|
2116
|
+
var SalefonyApiSdk = class {
|
|
2117
|
+
client;
|
|
2118
|
+
/** Admin API Kaynakları */
|
|
2119
|
+
admin;
|
|
2120
|
+
/** Frontstore API Kaynakları */
|
|
2121
|
+
frontstore;
|
|
2122
|
+
// Root level access for convenience (matches frontstore)
|
|
2123
|
+
store;
|
|
2124
|
+
collection;
|
|
2125
|
+
content;
|
|
2126
|
+
user;
|
|
2127
|
+
navigation;
|
|
2128
|
+
media;
|
|
2129
|
+
shop;
|
|
2130
|
+
utility;
|
|
2131
|
+
favorite;
|
|
2132
|
+
language;
|
|
2133
|
+
layouts;
|
|
2134
|
+
contentTypes;
|
|
2135
|
+
review;
|
|
2136
|
+
slugs;
|
|
2137
|
+
constructor(config) {
|
|
2138
|
+
this.client = new ApiClient(config);
|
|
2139
|
+
this.admin = new AdminNamespace(this.client);
|
|
2140
|
+
this.frontstore = new FrontstoreNamespace(this.client);
|
|
2141
|
+
this.store = this.frontstore.store;
|
|
2142
|
+
this.collection = this.frontstore.collection;
|
|
2143
|
+
this.content = this.frontstore.content;
|
|
2144
|
+
this.navigation = this.frontstore.navigation;
|
|
2145
|
+
this.media = this.frontstore.media;
|
|
2146
|
+
this.user = this.frontstore.user;
|
|
2147
|
+
this.shop = this.frontstore.shop;
|
|
2148
|
+
this.utility = this.frontstore.utility;
|
|
2149
|
+
this.favorite = this.frontstore.favorite;
|
|
2150
|
+
this.language = this.frontstore.language;
|
|
2151
|
+
this.layouts = this.frontstore.layouts;
|
|
2152
|
+
this.contentTypes = this.frontstore.contentTypes;
|
|
2153
|
+
this.review = this.frontstore.review;
|
|
2154
|
+
this.slugs = this.frontstore.slugs;
|
|
2155
|
+
}
|
|
2156
|
+
/**
|
|
2157
|
+
* Ekstra headerlar ekler (Method Chaining)
|
|
2158
|
+
*/
|
|
2159
|
+
setHeaders(headers) {
|
|
2160
|
+
this.client.setExtraHeaders(headers);
|
|
2161
|
+
return this;
|
|
2162
|
+
}
|
|
2163
|
+
/**
|
|
2164
|
+
* Bearer token ayarlar (Method Chaining)
|
|
2165
|
+
*/
|
|
2166
|
+
setAuthToken(token) {
|
|
2167
|
+
this.client.setAuthToken(token);
|
|
2168
|
+
return this;
|
|
2169
|
+
}
|
|
2170
|
+
/**
|
|
2171
|
+
* Vendor API anahtarı ayarlar (Method Chaining)
|
|
2172
|
+
*/
|
|
2173
|
+
setVendorKey(key) {
|
|
2174
|
+
this.client.setVendorKey(key);
|
|
2175
|
+
return this;
|
|
2176
|
+
}
|
|
2177
|
+
/**
|
|
2178
|
+
* Bearer token temizler (Method Chaining)
|
|
2179
|
+
*/
|
|
2180
|
+
logout() {
|
|
2181
|
+
this.client.clearAuth();
|
|
2182
|
+
return this;
|
|
2183
|
+
}
|
|
2184
|
+
/**
|
|
2185
|
+
* API Client instance'ını döner
|
|
2186
|
+
*/
|
|
2187
|
+
get apiClient() {
|
|
2188
|
+
return this.client;
|
|
2189
|
+
}
|
|
2190
|
+
};
|
|
2191
|
+
var createSDK = (config) => new SalefonyApiSdk(config);
|
|
2192
|
+
function getEnv() {
|
|
2193
|
+
if (typeof globalThis === "undefined") return void 0;
|
|
2194
|
+
try {
|
|
2195
|
+
const g = globalThis;
|
|
2196
|
+
return g.process?.env;
|
|
2197
|
+
} catch {
|
|
2198
|
+
return void 0;
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
function createSDKFromEnv(config = {}) {
|
|
2202
|
+
const env = getEnv();
|
|
2203
|
+
const baseUrl = config.baseUrl ?? env?.NEXT_PUBLIC_BACKEND_API_URL ?? env?.BACKEND_API_URL ?? "http://localhost:3031";
|
|
2204
|
+
const debug = config.debug ?? env?.NODE_ENV === "development";
|
|
2205
|
+
return createSDK({
|
|
2206
|
+
baseUrl,
|
|
2207
|
+
debug,
|
|
2208
|
+
...config
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2211
|
+
export {
|
|
2212
|
+
admin_exports as AdminResources,
|
|
2213
|
+
admin_exports2 as AdminTypes,
|
|
2214
|
+
ApiClient,
|
|
2215
|
+
BaseResource,
|
|
2216
|
+
common_exports as CommonTypes,
|
|
2217
|
+
CrudResource,
|
|
2218
|
+
frontstore_exports as FrontstoreResources,
|
|
2219
|
+
frontstore_exports2 as FrontstoreTypes,
|
|
2220
|
+
QueryBuilder,
|
|
2221
|
+
SalefonyApiSdk,
|
|
2222
|
+
SalefonyAuthError,
|
|
2223
|
+
SalefonyError,
|
|
2224
|
+
SalefonyNotFoundError,
|
|
2225
|
+
SalefonyValidationError,
|
|
2226
|
+
schema_exports as SchemaTypes,
|
|
2227
|
+
apiKeyColumns,
|
|
2228
|
+
collectionColumns,
|
|
2229
|
+
columns,
|
|
2230
|
+
contentColumns,
|
|
2231
|
+
createSDK,
|
|
2232
|
+
createSDKFromEnv,
|
|
2233
|
+
datasourceColumns,
|
|
2234
|
+
languageColumns,
|
|
2235
|
+
layoutColumns,
|
|
2236
|
+
metadataColumns,
|
|
2237
|
+
navigationColumns,
|
|
2238
|
+
projectColumns,
|
|
2239
|
+
sectionColumns,
|
|
2240
|
+
sectorColumns,
|
|
2241
|
+
storeColumns,
|
|
2242
|
+
unwrap,
|
|
2243
|
+
unwrapList,
|
|
2244
|
+
unwrapMeta,
|
|
2245
|
+
vendorColumns
|
|
2246
|
+
};
|