@appconda/nextjs 1.0.18 → 1.0.19
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/Cache/Adapter.js +1 -0
- package/dist/Cache/Adapters/Filesystem.js +102 -0
- package/dist/Cache/Adapters/Memory.js +46 -0
- package/dist/Cache/Adapters/None.js +27 -0
- package/dist/Cache/Adapters/Redis.js +79 -0
- package/dist/Cache/Adapters/Sharding.js +72 -0
- package/dist/Cache/Cache.js +51 -0
- package/dist/Cache/index.js +5 -0
- package/dist/Cache/test.js +0 -0
- package/dist/Services.js +28 -0
- package/dist/actions/actionClient.js +35 -0
- package/dist/actions/index.js +1 -0
- package/dist/actions/nodes.js +9 -0
- package/dist/client.js +334 -0
- package/dist/decorators/Cache.js +78 -0
- package/dist/decorators/CacheKey.js +8 -0
- package/dist/decorators/Invalidate.js +46 -0
- package/dist/enums/api-service.js +14 -0
- package/dist/enums/api.js +6 -0
- package/dist/enums/auth-method.js +10 -0
- package/dist/enums/authentication-factor.js +7 -0
- package/dist/enums/authenticator-type.js +4 -0
- package/dist/enums/browser.js +17 -0
- package/dist/enums/compression.js +6 -0
- package/dist/enums/credit-card.js +19 -0
- package/dist/enums/database-usage-range.js +6 -0
- package/dist/enums/email-template-locale.js +134 -0
- package/dist/enums/email-template-type.js +10 -0
- package/dist/enums/entities/EntityLimitType.js +5 -0
- package/dist/enums/entities/PropertyAttributeName.js +28 -0
- package/dist/enums/entities/PropertyCondition.js +9 -0
- package/dist/enums/entities/PropertyType.js +17 -0
- package/dist/enums/entities/PropertyValueType.js +7 -0
- package/dist/enums/entities/RowAccess.js +1 -0
- package/dist/enums/entities/ViewFilterCondition.js +13 -0
- package/dist/enums/execution-method.js +9 -0
- package/dist/enums/flag.js +198 -0
- package/dist/enums/function-usage-range.js +6 -0
- package/dist/enums/image-format.js +8 -0
- package/dist/enums/image-gravity.js +12 -0
- package/dist/enums/index-type.js +6 -0
- package/dist/enums/messaging-provider-type.js +6 -0
- package/dist/enums/name.js +15 -0
- package/dist/enums/o-auth-provider copy.js +42 -0
- package/dist/enums/o-auth-provider.js +42 -0
- package/dist/enums/password-hash.js +14 -0
- package/dist/enums/platform-type.js +18 -0
- package/dist/enums/project-usage-range.js +5 -0
- package/dist/enums/region.js +5 -0
- package/dist/enums/relation-mutate.js +6 -0
- package/dist/enums/relationship-type.js +7 -0
- package/dist/enums/resource-type.js +5 -0
- package/dist/enums/runtime.js +49 -0
- package/dist/enums/s-m-t-p-secure.js +4 -0
- package/dist/enums/shared/ApplicationLayout.js +5 -0
- package/dist/enums/shared/Colors.js +25 -0
- package/dist/enums/shared/InputType.js +7 -0
- package/dist/enums/shared/Periodicity.js +8 -0
- package/dist/enums/shared/SvgIcon.js +38 -0
- package/dist/enums/shared/Theme.js +5 -0
- package/dist/enums/sms-template-locale.js +134 -0
- package/dist/enums/sms-template-type.js +7 -0
- package/dist/enums/smtp-encryption.js +6 -0
- package/dist/enums/storage-usage-range.js +6 -0
- package/dist/enums/subscriptions/PricingModel.js +11 -0
- package/dist/enums/subscriptions/SubscriptionBillingPeriod.js +10 -0
- package/dist/enums/subscriptions/SubscriptionFeatureLimitType.js +12 -0
- package/dist/enums/subscriptions/SubscriptionPriceType.js +7 -0
- package/dist/enums/tenants/LinkedAccountStatus.js +6 -0
- package/dist/enums/tenants/TenantUserJoined.js +7 -0
- package/dist/enums/tenants/TenantUserStatus.js +7 -0
- package/dist/enums/tenants/TenantUserType.js +6 -0
- package/dist/enums/user-usage-range.js +6 -0
- package/dist/getAppcondaClient.js +42 -0
- package/dist/getSDKForCurrentUser.js +62 -0
- package/dist/id.js +44 -0
- package/dist/iife/sdk.js +7063 -7805
- package/dist/index.js +12558 -0
- package/dist/index.js.map +1 -0
- package/dist/inputFile.js +16 -0
- package/dist/lib/Registry/Registry.js +55 -0
- package/dist/lib/Registry/index.js +1 -0
- package/dist/models.js +1 -0
- package/dist/permission.js +53 -0
- package/dist/query.js +203 -0
- package/dist/role.js +93 -0
- package/dist/service-client.js +13 -0
- package/dist/service.js +22 -0
- package/dist/services/account.js +1259 -0
- package/dist/services/applets.js +39 -0
- package/dist/services/avatars.js +250 -0
- package/dist/services/community.js +68 -0
- package/dist/services/configuration.js +10 -0
- package/dist/services/databases.js +1735 -0
- package/dist/services/functions.js +809 -0
- package/dist/services/graphql.js +56 -0
- package/dist/services/health.js +462 -0
- package/dist/services/locale.js +143 -0
- package/dist/services/messaging.js +1919 -0
- package/dist/services/node.js +10 -0
- package/dist/services/permissions.js +89 -0
- package/dist/services/pricing.js +20 -0
- package/dist/services/projects.js +1525 -0
- package/dist/services/roles.js +71 -0
- package/dist/services/schema.js +47 -0
- package/dist/services/storage.js +473 -0
- package/dist/services/subscription.js +45 -0
- package/dist/services/teams.js +394 -0
- package/dist/services/tenant-subscription.js +51 -0
- package/dist/services/tenant.js +124 -0
- package/dist/services/users.js +1282 -0
- package/dist/services/waitlist.js +11 -0
- package/package.json +5 -12
- package/tsconfig.json +2 -1
- package/dist/cjs/sdk.js +0 -13300
- package/dist/cjs/sdk.js.map +0 -1
- package/dist/esm/sdk.js +0 -13278
- package/dist/esm/sdk.js.map +0 -1
package/dist/client.js
ADDED
@@ -0,0 +1,334 @@
|
|
1
|
+
import { fetch, FormData, File } from 'node-fetch-native-with-agent';
|
2
|
+
import { createAgent } from 'node-fetch-native-with-agent/agent';
|
3
|
+
class AppcondaException extends Error {
|
4
|
+
constructor(message, code = 0, type = '', response = '') {
|
5
|
+
super(message);
|
6
|
+
this.name = 'AppcondaException';
|
7
|
+
this.message = message;
|
8
|
+
this.code = code;
|
9
|
+
this.type = type;
|
10
|
+
this.response = response;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
function getUserAgent() {
|
14
|
+
let ua = 'AppcondaNodeJSSDK/14.1.0';
|
15
|
+
// `process` is a global in Node.js, but not fully available in all runtimes.
|
16
|
+
const platform = [];
|
17
|
+
if (typeof process !== 'undefined') {
|
18
|
+
if (typeof process.platform === 'string')
|
19
|
+
platform.push(process.platform);
|
20
|
+
if (typeof process.arch === 'string')
|
21
|
+
platform.push(process.arch);
|
22
|
+
}
|
23
|
+
if (platform.length > 0) {
|
24
|
+
ua += ` (${platform.join('; ')})`;
|
25
|
+
}
|
26
|
+
// `navigator.userAgent` is available in Node.js 21 and later.
|
27
|
+
// It's also part of the WinterCG spec, so many edge runtimes provide it.
|
28
|
+
// https://common-min-api.proposal.wintercg.org/#requirements-for-navigatoruseragent
|
29
|
+
// @ts-ignore
|
30
|
+
if (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string') {
|
31
|
+
// @ts-ignore
|
32
|
+
ua += ` ${navigator.userAgent}`;
|
33
|
+
// @ts-ignore
|
34
|
+
}
|
35
|
+
else if (typeof globalThis.EdgeRuntime === 'string') {
|
36
|
+
ua += ` EdgeRuntime`;
|
37
|
+
// Older Node.js versions don't have `navigator.userAgent`, so we have to use `process.version`.
|
38
|
+
}
|
39
|
+
else if (typeof process !== 'undefined' && typeof process.version === 'string') {
|
40
|
+
ua += ` Node.js/${process.version}`;
|
41
|
+
}
|
42
|
+
return ua;
|
43
|
+
}
|
44
|
+
class Client {
|
45
|
+
constructor() {
|
46
|
+
this.config = {
|
47
|
+
endpoint: 'https://cloud.appconda.io/v1',
|
48
|
+
selfSigned: false,
|
49
|
+
project: '',
|
50
|
+
mode: '',
|
51
|
+
key: '',
|
52
|
+
jwt: '',
|
53
|
+
locale: '',
|
54
|
+
session: '',
|
55
|
+
forwardeduseragent: '',
|
56
|
+
};
|
57
|
+
this.headers = {
|
58
|
+
'x-sdk-name': 'Node.js',
|
59
|
+
'x-sdk-platform': 'server',
|
60
|
+
'x-sdk-language': 'nodejs',
|
61
|
+
'x-sdk-version': '14.1.0',
|
62
|
+
'user-agent': getUserAgent(),
|
63
|
+
'X-Appconda-Response-Format': '1.6.0',
|
64
|
+
};
|
65
|
+
}
|
66
|
+
/**
|
67
|
+
* Set Endpoint
|
68
|
+
*
|
69
|
+
* Your project endpoint
|
70
|
+
*
|
71
|
+
* @param {string} endpoint
|
72
|
+
*
|
73
|
+
* @returns {this}
|
74
|
+
*/
|
75
|
+
setEndpoint(endpoint) {
|
76
|
+
this.config.endpoint = endpoint;
|
77
|
+
return this;
|
78
|
+
}
|
79
|
+
/**
|
80
|
+
* Set self-signed
|
81
|
+
*
|
82
|
+
* @param {boolean} selfSigned
|
83
|
+
*
|
84
|
+
* @returns {this}
|
85
|
+
*/
|
86
|
+
setSelfSigned(selfSigned) {
|
87
|
+
// @ts-ignore
|
88
|
+
if (typeof globalThis.EdgeRuntime !== 'undefined') {
|
89
|
+
console.warn('setSelfSigned is not supported in edge runtimes.');
|
90
|
+
}
|
91
|
+
this.config.selfSigned = selfSigned;
|
92
|
+
return this;
|
93
|
+
}
|
94
|
+
/**
|
95
|
+
* Add header
|
96
|
+
*
|
97
|
+
* @param {string} header
|
98
|
+
* @param {string} value
|
99
|
+
*
|
100
|
+
* @returns {this}
|
101
|
+
*/
|
102
|
+
addHeader(header, value) {
|
103
|
+
this.headers[header.toLowerCase()] = value;
|
104
|
+
return this;
|
105
|
+
}
|
106
|
+
/**
|
107
|
+
* Set Project
|
108
|
+
*
|
109
|
+
* Your project ID
|
110
|
+
*
|
111
|
+
* @param value string
|
112
|
+
*
|
113
|
+
* @return {this}
|
114
|
+
*/
|
115
|
+
setProject(value) {
|
116
|
+
this.headers['X-Appconda-Project'] = value;
|
117
|
+
this.config.project = value;
|
118
|
+
return this;
|
119
|
+
}
|
120
|
+
/**
|
121
|
+
* Set Mode
|
122
|
+
*
|
123
|
+
* @param value string
|
124
|
+
*
|
125
|
+
* @return {this}
|
126
|
+
*/
|
127
|
+
setMode(value) {
|
128
|
+
this.headers['X-Appconda-Mode'] = value;
|
129
|
+
this.config.mode = value;
|
130
|
+
return this;
|
131
|
+
}
|
132
|
+
/**
|
133
|
+
* Set Key
|
134
|
+
*
|
135
|
+
* Your secret API key
|
136
|
+
*
|
137
|
+
* @param value string
|
138
|
+
*
|
139
|
+
* @return {this}
|
140
|
+
*/
|
141
|
+
setKey(value) {
|
142
|
+
this.headers['X-Appconda-Key'] = value;
|
143
|
+
this.config.key = value;
|
144
|
+
return this;
|
145
|
+
}
|
146
|
+
/**
|
147
|
+
* Set JWT
|
148
|
+
*
|
149
|
+
* Your secret JSON Web Token
|
150
|
+
*
|
151
|
+
* @param value string
|
152
|
+
*
|
153
|
+
* @return {this}
|
154
|
+
*/
|
155
|
+
setJWT(value) {
|
156
|
+
this.headers['X-Appconda-JWT'] = value;
|
157
|
+
this.config.jwt = value;
|
158
|
+
return this;
|
159
|
+
}
|
160
|
+
/**
|
161
|
+
* Set Locale
|
162
|
+
*
|
163
|
+
* @param value string
|
164
|
+
*
|
165
|
+
* @return {this}
|
166
|
+
*/
|
167
|
+
setLocale(value) {
|
168
|
+
this.headers['X-Appconda-Locale'] = value;
|
169
|
+
this.config.locale = value;
|
170
|
+
return this;
|
171
|
+
}
|
172
|
+
/**
|
173
|
+
* Set Session
|
174
|
+
*
|
175
|
+
* The user session to authenticate with
|
176
|
+
*
|
177
|
+
* @param value string
|
178
|
+
*
|
179
|
+
* @return {this}
|
180
|
+
*/
|
181
|
+
setSession(value) {
|
182
|
+
this.headers['X-Appconda-Session'] = value;
|
183
|
+
this.config.session = value;
|
184
|
+
return this;
|
185
|
+
}
|
186
|
+
/**
|
187
|
+
* Set ForwardedUserAgent
|
188
|
+
*
|
189
|
+
* The user agent string of the client that made the request
|
190
|
+
*
|
191
|
+
* @param value string
|
192
|
+
*
|
193
|
+
* @return {this}
|
194
|
+
*/
|
195
|
+
setForwardedUserAgent(value) {
|
196
|
+
this.headers['X-Forwarded-User-Agent'] = value;
|
197
|
+
this.config.forwardeduseragent = value;
|
198
|
+
return this;
|
199
|
+
}
|
200
|
+
setFallbackCookies(value) {
|
201
|
+
this.headers['X-Fallback-Cookies'] = value;
|
202
|
+
//this.config.forwardeduseragent = value;
|
203
|
+
return this;
|
204
|
+
}
|
205
|
+
prepareRequest(method, url, headers = {}, params = {}) {
|
206
|
+
method = method.toUpperCase();
|
207
|
+
headers = Object.assign({}, this.headers, headers);
|
208
|
+
let options = {
|
209
|
+
method,
|
210
|
+
headers,
|
211
|
+
...createAgent(this.config.endpoint, { rejectUnauthorized: !this.config.selfSigned }),
|
212
|
+
};
|
213
|
+
if (method === 'GET') {
|
214
|
+
for (const [key, value] of Object.entries(Client.flatten(params))) {
|
215
|
+
url.searchParams.append(key, value);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
else {
|
219
|
+
switch (headers['content-type']) {
|
220
|
+
case 'application/json':
|
221
|
+
options.body = JSON.stringify(params);
|
222
|
+
break;
|
223
|
+
case 'multipart/form-data':
|
224
|
+
const formData = new FormData();
|
225
|
+
for (const [key, value] of Object.entries(params)) {
|
226
|
+
if (value instanceof File) {
|
227
|
+
formData.append(key, value, value.name);
|
228
|
+
}
|
229
|
+
else if (Array.isArray(value)) {
|
230
|
+
for (const nestedValue of value) {
|
231
|
+
formData.append(`${key}[]`, nestedValue);
|
232
|
+
}
|
233
|
+
}
|
234
|
+
else {
|
235
|
+
formData.append(key, value);
|
236
|
+
}
|
237
|
+
}
|
238
|
+
options.body = formData;
|
239
|
+
delete headers['content-type'];
|
240
|
+
break;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
return { uri: url.toString(), options };
|
244
|
+
}
|
245
|
+
async chunkedUpload(method, url, headers = {}, originalPayload = {}, onProgress) {
|
246
|
+
const file = Object.values(originalPayload).find((value) => value instanceof File);
|
247
|
+
if (file.size <= Client.CHUNK_SIZE) {
|
248
|
+
return await this.call(method, url, headers, originalPayload);
|
249
|
+
}
|
250
|
+
let start = 0;
|
251
|
+
let response = null;
|
252
|
+
while (start < file.size) {
|
253
|
+
let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk
|
254
|
+
if (end >= file.size) {
|
255
|
+
end = file.size; // Adjust for the last chunk to include the last byte
|
256
|
+
}
|
257
|
+
headers['content-range'] = `bytes ${start}-${end - 1}/${file.size}`;
|
258
|
+
const chunk = file.slice(start, end);
|
259
|
+
let payload = { ...originalPayload, file: new File([chunk], file.name) };
|
260
|
+
response = await this.call(method, url, headers, payload);
|
261
|
+
if (onProgress && typeof onProgress === 'function') {
|
262
|
+
onProgress({
|
263
|
+
$id: response.$id,
|
264
|
+
progress: Math.round((end / file.size) * 100),
|
265
|
+
sizeUploaded: end,
|
266
|
+
chunksTotal: Math.ceil(file.size / Client.CHUNK_SIZE),
|
267
|
+
chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE)
|
268
|
+
});
|
269
|
+
}
|
270
|
+
if (response && response.$id) {
|
271
|
+
headers['x-appconda-id'] = response.$id;
|
272
|
+
}
|
273
|
+
start = end;
|
274
|
+
}
|
275
|
+
return response;
|
276
|
+
}
|
277
|
+
async redirect(method, url, headers = {}, params = {}) {
|
278
|
+
const { uri, options } = this.prepareRequest(method, url, headers, params);
|
279
|
+
const response = await fetch(uri, {
|
280
|
+
...options,
|
281
|
+
redirect: 'manual'
|
282
|
+
});
|
283
|
+
if (response.status !== 301 && response.status !== 302) {
|
284
|
+
throw new AppcondaException('Invalid redirect', response.status);
|
285
|
+
}
|
286
|
+
return response.headers.get('location') || '';
|
287
|
+
}
|
288
|
+
async call(method, url, headers = {}, params = {}, responseType = 'json') {
|
289
|
+
const { uri, options } = this.prepareRequest(method, url, headers, params);
|
290
|
+
let data = null;
|
291
|
+
try {
|
292
|
+
const response = await fetch(uri, options);
|
293
|
+
const warnings = response.headers.get('x-appconda-warning');
|
294
|
+
if (warnings) {
|
295
|
+
warnings.split(';').forEach((warning) => console.warn('Warning: ' + warning));
|
296
|
+
}
|
297
|
+
if (response.headers.get('content-type')?.includes('application/json')) {
|
298
|
+
data = await response.json();
|
299
|
+
}
|
300
|
+
else if (responseType === 'arrayBuffer') {
|
301
|
+
data = await response.arrayBuffer();
|
302
|
+
}
|
303
|
+
else {
|
304
|
+
data = {
|
305
|
+
message: await response.text()
|
306
|
+
};
|
307
|
+
}
|
308
|
+
if (400 <= response.status) {
|
309
|
+
throw new AppcondaException(data?.message, response.status, data?.type, data);
|
310
|
+
}
|
311
|
+
return data;
|
312
|
+
}
|
313
|
+
catch (e) {
|
314
|
+
console.error(e);
|
315
|
+
throw e;
|
316
|
+
}
|
317
|
+
}
|
318
|
+
static flatten(data, prefix = '') {
|
319
|
+
let output = {};
|
320
|
+
for (const [key, value] of Object.entries(data)) {
|
321
|
+
let finalKey = prefix ? prefix + '[' + key + ']' : key;
|
322
|
+
if (Array.isArray(value)) {
|
323
|
+
output = { ...output, ...Client.flatten(value, finalKey) };
|
324
|
+
}
|
325
|
+
else {
|
326
|
+
output[finalKey] = value;
|
327
|
+
}
|
328
|
+
}
|
329
|
+
return output;
|
330
|
+
}
|
331
|
+
}
|
332
|
+
Client.CHUNK_SIZE = 1024 * 1024 * 5;
|
333
|
+
export { Client, AppcondaException };
|
334
|
+
export { Query } from './query';
|
@@ -0,0 +1,78 @@
|
|
1
|
+
import { Services } from "@/Services";
|
2
|
+
function stableStringify(obj) {
|
3
|
+
if (obj && typeof obj === "object" && !Array.isArray(obj)) {
|
4
|
+
return `{${Object.keys(obj).sort().map(key => `"${key}":${stableStringify(obj[key])}`).join(",")}}`;
|
5
|
+
}
|
6
|
+
return JSON.stringify(obj);
|
7
|
+
}
|
8
|
+
function generateCacheKey(...args) {
|
9
|
+
return stableStringify(args);
|
10
|
+
}
|
11
|
+
// console.log(generateCacheKey("user", 123, true, { role: "admin", permissions: ["read", "write"] }));
|
12
|
+
// console.log(generateCacheKey("user", 123, true, { permissions: ["read", "write"], role: "admin" }));
|
13
|
+
export function Cache( /* cacheKey?: string | string[] */) {
|
14
|
+
return function (target, propertyKey, descriptor) {
|
15
|
+
const originalMethod = descriptor.value;
|
16
|
+
descriptor.value = async function (...args) {
|
17
|
+
const className = target.constructor.name.toLowerCase();
|
18
|
+
// Metod adı
|
19
|
+
const methodName = propertyKey.toLowerCase();
|
20
|
+
const cacheKeys = [target.__cacheKeys || []].reverse();
|
21
|
+
console.log("Defined cache keys:", cacheKeys);
|
22
|
+
const cacheKey = ['admin', className, propertyKey];
|
23
|
+
if (cacheKeys.length > 0) {
|
24
|
+
for (let i = 0; i < cacheKeys.length; i++) {
|
25
|
+
const keyIndex = cacheKeys[i]['parameterIndex'];
|
26
|
+
if (args != null && args[keyIndex] != null) {
|
27
|
+
const key = args[keyIndex].toString();
|
28
|
+
cacheKey.push(key);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
else if (args.length > 0) { //cacheKey belirtilmemisse tum parametreleri kullan
|
33
|
+
for (let i = 0; i < args.length; i++) {
|
34
|
+
const key = args[i].toString();
|
35
|
+
cacheKey.push(key);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
// Cache key'i dizeye dönüştür
|
39
|
+
// const key = Array.isArray(cacheKey) ? cacheKey.join(':') : cacheKey;
|
40
|
+
// Cache'ten veri al
|
41
|
+
let cachedData = await Services.Cache.load(cacheKey);
|
42
|
+
if (cachedData != null) {
|
43
|
+
return cachedData; // Cache'teki veriyi döndür
|
44
|
+
}
|
45
|
+
// Orijinal metodu çağır ve dönen değeri cache'e kaydet
|
46
|
+
const result = await originalMethod.apply(this, args);
|
47
|
+
// Cache'e kaydet (asenkron yapılır, beklenmez)
|
48
|
+
Services.Cache.save(cacheKey, result);
|
49
|
+
console.log('------------------------------Cache executed..');
|
50
|
+
return result;
|
51
|
+
};
|
52
|
+
return descriptor;
|
53
|
+
};
|
54
|
+
}
|
55
|
+
/* const cacheKeys: any[] = target.__cacheKeys || [];
|
56
|
+
console.log("Defined cache keys:", [...cacheKeys].reverse());
|
57
|
+
|
58
|
+
const className = target.constructor.name.toLowerCase();
|
59
|
+
|
60
|
+
// Metod adı
|
61
|
+
const methodName = propertyKey.toLowerCase();
|
62
|
+
|
63
|
+
debugger
|
64
|
+
const cacheKey = ['admin', className, propertyKey];
|
65
|
+
if (cacheKey.length > 0) {
|
66
|
+
for (let i = 0; i < cacheKeys.length; i++) {
|
67
|
+
const keyIndex = cacheKeys[i]['parameterIndex'];
|
68
|
+
if (args != null && args[keyIndex] != null) {
|
69
|
+
const key = args[keyIndex].toString();
|
70
|
+
cacheKey.push(key);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
} else if (args.length > 0) { //cacheKey belirtilmemisse tum parametreleri kullan
|
74
|
+
for (let i = 0; i < args.length; i++) {
|
75
|
+
const key = args[i].toString();
|
76
|
+
cacheKey.push(key);
|
77
|
+
}
|
78
|
+
} */
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { Services } from "@/Services";
|
2
|
+
export function Invalidate(keys) {
|
3
|
+
return function (target, propertyKey, descriptor) {
|
4
|
+
const originalMethod = descriptor.value;
|
5
|
+
descriptor.value = async function (...args) {
|
6
|
+
const className = target.constructor.name.toLowerCase();
|
7
|
+
// Metod adı
|
8
|
+
const methodName = propertyKey.toLowerCase();
|
9
|
+
const cacheKey = ['admin', className];
|
10
|
+
// Orijinal metodu çağır ve dönen değeri cache'e kaydet
|
11
|
+
const result = await originalMethod.apply(this, args);
|
12
|
+
// Cache'e kaydet (asenkron yapılır, beklenmez)
|
13
|
+
for (let key of keys) {
|
14
|
+
Services.Cache.purge([...cacheKey, key]);
|
15
|
+
Services.Cache.delWithStart([...cacheKey, key]);
|
16
|
+
}
|
17
|
+
console.log('------------------------------Cache deleted.');
|
18
|
+
return result;
|
19
|
+
};
|
20
|
+
return descriptor;
|
21
|
+
};
|
22
|
+
}
|
23
|
+
/* const cacheKeys: any[] = target.__cacheKeys || [];
|
24
|
+
console.log("Defined cache keys:", [...cacheKeys].reverse());
|
25
|
+
|
26
|
+
const className = target.constructor.name.toLowerCase();
|
27
|
+
|
28
|
+
// Metod adı
|
29
|
+
const methodName = propertyKey.toLowerCase();
|
30
|
+
|
31
|
+
debugger
|
32
|
+
const cacheKey = ['admin', className, propertyKey];
|
33
|
+
if (cacheKey.length > 0) {
|
34
|
+
for (let i = 0; i < cacheKeys.length; i++) {
|
35
|
+
const keyIndex = cacheKeys[i]['parameterIndex'];
|
36
|
+
if (args != null && args[keyIndex] != null) {
|
37
|
+
const key = args[keyIndex].toString();
|
38
|
+
cacheKey.push(key);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
} else if (args.length > 0) { //cacheKey belirtilmemisse tum parametreleri kullan
|
42
|
+
for (let i = 0; i < args.length; i++) {
|
43
|
+
const key = args[i].toString();
|
44
|
+
cacheKey.push(key);
|
45
|
+
}
|
46
|
+
} */
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export var ApiService;
|
2
|
+
(function (ApiService) {
|
3
|
+
ApiService["Account"] = "account";
|
4
|
+
ApiService["Avatars"] = "avatars";
|
5
|
+
ApiService["Databases"] = "databases";
|
6
|
+
ApiService["Locale"] = "locale";
|
7
|
+
ApiService["Health"] = "health";
|
8
|
+
ApiService["Storage"] = "storage";
|
9
|
+
ApiService["Teams"] = "teams";
|
10
|
+
ApiService["Users"] = "users";
|
11
|
+
ApiService["Functions"] = "functions";
|
12
|
+
ApiService["Graphql"] = "graphql";
|
13
|
+
ApiService["Messaging"] = "messaging";
|
14
|
+
})(ApiService || (ApiService = {}));
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export var AuthMethod;
|
2
|
+
(function (AuthMethod) {
|
3
|
+
AuthMethod["Emailpassword"] = "email-password";
|
4
|
+
AuthMethod["Magicurl"] = "magic-url";
|
5
|
+
AuthMethod["Emailotp"] = "email-otp";
|
6
|
+
AuthMethod["Anonymous"] = "anonymous";
|
7
|
+
AuthMethod["Invites"] = "invites";
|
8
|
+
AuthMethod["Jwt"] = "jwt";
|
9
|
+
AuthMethod["Phone"] = "phone";
|
10
|
+
})(AuthMethod || (AuthMethod = {}));
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export var AuthenticationFactor;
|
2
|
+
(function (AuthenticationFactor) {
|
3
|
+
AuthenticationFactor["Email"] = "email";
|
4
|
+
AuthenticationFactor["Phone"] = "phone";
|
5
|
+
AuthenticationFactor["Totp"] = "totp";
|
6
|
+
AuthenticationFactor["Recoverycode"] = "recoverycode";
|
7
|
+
})(AuthenticationFactor || (AuthenticationFactor = {}));
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export var Browser;
|
2
|
+
(function (Browser) {
|
3
|
+
Browser["AvantBrowser"] = "aa";
|
4
|
+
Browser["AndroidWebViewBeta"] = "an";
|
5
|
+
Browser["GoogleChrome"] = "ch";
|
6
|
+
Browser["GoogleChromeIOS"] = "ci";
|
7
|
+
Browser["GoogleChromeMobile"] = "cm";
|
8
|
+
Browser["Chromium"] = "cr";
|
9
|
+
Browser["MozillaFirefox"] = "ff";
|
10
|
+
Browser["Safari"] = "sf";
|
11
|
+
Browser["MobileSafari"] = "mf";
|
12
|
+
Browser["MicrosoftEdge"] = "ps";
|
13
|
+
Browser["MicrosoftEdgeIOS"] = "oi";
|
14
|
+
Browser["OperaMini"] = "om";
|
15
|
+
Browser["Opera"] = "op";
|
16
|
+
Browser["OperaNext"] = "on";
|
17
|
+
})(Browser || (Browser = {}));
|
@@ -0,0 +1,19 @@
|
|
1
|
+
export var CreditCard;
|
2
|
+
(function (CreditCard) {
|
3
|
+
CreditCard["AmericanExpress"] = "amex";
|
4
|
+
CreditCard["Argencard"] = "argencard";
|
5
|
+
CreditCard["Cabal"] = "cabal";
|
6
|
+
CreditCard["Cencosud"] = "cencosud";
|
7
|
+
CreditCard["DinersClub"] = "diners";
|
8
|
+
CreditCard["Discover"] = "discover";
|
9
|
+
CreditCard["Elo"] = "elo";
|
10
|
+
CreditCard["Hipercard"] = "hipercard";
|
11
|
+
CreditCard["JCB"] = "jcb";
|
12
|
+
CreditCard["Mastercard"] = "mastercard";
|
13
|
+
CreditCard["Naranja"] = "naranja";
|
14
|
+
CreditCard["TarjetaShopping"] = "targeta-shopping";
|
15
|
+
CreditCard["UnionChinaPay"] = "union-china-pay";
|
16
|
+
CreditCard["Visa"] = "visa";
|
17
|
+
CreditCard["MIR"] = "mir";
|
18
|
+
CreditCard["Maestro"] = "maestro";
|
19
|
+
})(CreditCard || (CreditCard = {}));
|