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