@appconda/nextjs 1.0.17 → 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.
Files changed (236) hide show
  1. package/dist/Cache/Adapter.js +1 -0
  2. package/dist/Cache/Adapters/Filesystem.js +102 -0
  3. package/dist/Cache/Adapters/Memory.js +46 -0
  4. package/dist/Cache/Adapters/None.js +27 -0
  5. package/dist/Cache/Adapters/Redis.js +79 -0
  6. package/dist/Cache/Adapters/Sharding.js +72 -0
  7. package/dist/Cache/Cache.js +51 -0
  8. package/dist/Cache/index.js +5 -0
  9. package/dist/Cache/test.js +0 -0
  10. package/dist/Services.js +28 -0
  11. package/dist/actions/actionClient.js +35 -0
  12. package/dist/actions/index.js +1 -0
  13. package/dist/actions/nodes.js +9 -0
  14. package/dist/client.js +334 -0
  15. package/dist/decorators/Cache.js +78 -0
  16. package/dist/decorators/CacheKey.js +8 -0
  17. package/dist/decorators/Invalidate.js +46 -0
  18. package/dist/enums/api-service.js +14 -0
  19. package/dist/enums/api.js +6 -0
  20. package/dist/enums/auth-method.js +10 -0
  21. package/dist/enums/authentication-factor.js +7 -0
  22. package/dist/enums/authenticator-type.js +4 -0
  23. package/dist/enums/browser.js +17 -0
  24. package/dist/enums/compression.js +6 -0
  25. package/dist/enums/credit-card.js +19 -0
  26. package/dist/enums/database-usage-range.js +6 -0
  27. package/dist/enums/email-template-locale.js +134 -0
  28. package/dist/enums/email-template-type.js +10 -0
  29. package/dist/enums/entities/EntityLimitType.js +5 -0
  30. package/dist/enums/entities/PropertyAttributeName.js +28 -0
  31. package/dist/enums/entities/PropertyCondition.js +9 -0
  32. package/dist/enums/entities/PropertyType.js +17 -0
  33. package/dist/enums/entities/PropertyValueType.js +7 -0
  34. package/dist/enums/entities/RowAccess.js +1 -0
  35. package/dist/enums/entities/ViewFilterCondition.js +13 -0
  36. package/dist/enums/execution-method.js +9 -0
  37. package/dist/enums/flag.js +198 -0
  38. package/dist/enums/function-usage-range.js +6 -0
  39. package/dist/enums/image-format.js +8 -0
  40. package/dist/enums/image-gravity.js +12 -0
  41. package/dist/enums/index-type.js +6 -0
  42. package/dist/enums/messaging-provider-type.js +6 -0
  43. package/dist/enums/name.js +15 -0
  44. package/dist/enums/o-auth-provider copy.js +42 -0
  45. package/dist/enums/o-auth-provider.js +42 -0
  46. package/dist/enums/password-hash.js +14 -0
  47. package/dist/enums/platform-type.js +18 -0
  48. package/dist/enums/project-usage-range.js +5 -0
  49. package/dist/enums/region.js +5 -0
  50. package/dist/enums/relation-mutate.js +6 -0
  51. package/dist/enums/relationship-type.js +7 -0
  52. package/dist/enums/resource-type.js +5 -0
  53. package/dist/enums/runtime.js +49 -0
  54. package/dist/enums/s-m-t-p-secure.js +4 -0
  55. package/dist/enums/shared/ApplicationLayout.js +5 -0
  56. package/dist/enums/shared/Colors.js +25 -0
  57. package/dist/enums/shared/InputType.js +7 -0
  58. package/dist/enums/shared/Periodicity.js +8 -0
  59. package/dist/enums/shared/SvgIcon.js +38 -0
  60. package/dist/enums/shared/Theme.js +5 -0
  61. package/dist/enums/sms-template-locale.js +134 -0
  62. package/dist/enums/sms-template-type.js +7 -0
  63. package/dist/enums/smtp-encryption.js +6 -0
  64. package/dist/enums/storage-usage-range.js +6 -0
  65. package/dist/enums/subscriptions/PricingModel.js +11 -0
  66. package/dist/enums/subscriptions/SubscriptionBillingPeriod.js +10 -0
  67. package/dist/enums/subscriptions/SubscriptionFeatureLimitType.js +12 -0
  68. package/dist/enums/subscriptions/SubscriptionPriceType.js +7 -0
  69. package/dist/enums/tenants/LinkedAccountStatus.js +6 -0
  70. package/dist/enums/tenants/TenantUserJoined.js +7 -0
  71. package/dist/enums/tenants/TenantUserStatus.js +7 -0
  72. package/dist/enums/tenants/TenantUserType.js +6 -0
  73. package/dist/enums/user-usage-range.js +6 -0
  74. package/dist/getAppcondaClient.js +42 -0
  75. package/dist/getSDKForCurrentUser.js +62 -0
  76. package/dist/id.js +44 -0
  77. package/dist/iife/sdk.js +7063 -7805
  78. package/dist/index.js +12558 -0
  79. package/dist/index.js.map +1 -0
  80. package/dist/inputFile.js +16 -0
  81. package/dist/lib/Registry/Registry.js +55 -0
  82. package/dist/lib/Registry/index.js +1 -0
  83. package/dist/models.js +1 -0
  84. package/dist/permission.js +53 -0
  85. package/dist/query.js +203 -0
  86. package/dist/role.js +93 -0
  87. package/dist/service-client.js +13 -0
  88. package/dist/service.js +22 -0
  89. package/dist/services/account.js +1259 -0
  90. package/dist/services/applets.js +39 -0
  91. package/dist/services/avatars.js +250 -0
  92. package/dist/services/community.js +68 -0
  93. package/dist/services/configuration.js +10 -0
  94. package/dist/services/databases.js +1735 -0
  95. package/dist/services/functions.js +809 -0
  96. package/dist/services/graphql.js +56 -0
  97. package/dist/services/health.js +462 -0
  98. package/dist/services/locale.js +143 -0
  99. package/dist/services/messaging.js +1919 -0
  100. package/dist/services/node.js +10 -0
  101. package/dist/services/permissions.js +89 -0
  102. package/dist/services/pricing.js +20 -0
  103. package/dist/services/projects.js +1525 -0
  104. package/dist/services/roles.js +71 -0
  105. package/dist/services/schema.js +47 -0
  106. package/dist/services/storage.js +473 -0
  107. package/dist/services/subscription.js +45 -0
  108. package/dist/services/teams.js +394 -0
  109. package/dist/services/tenant-subscription.js +51 -0
  110. package/dist/services/tenant.js +124 -0
  111. package/dist/services/users.js +1282 -0
  112. package/dist/services/waitlist.js +11 -0
  113. package/package.json +5 -12
  114. package/tsconfig.json +2 -1
  115. package/types/Cache/Adapter.d.ts +10 -0
  116. package/types/Cache/Adapters/Filesystem.d.ts +16 -0
  117. package/types/Cache/Adapters/Memory.d.ts +18 -0
  118. package/types/Cache/Adapters/None.d.ts +12 -0
  119. package/types/Cache/Adapters/Redis.d.ts +14 -0
  120. package/types/Cache/Adapters/Sharding.d.ts +17 -0
  121. package/types/Cache/Cache.d.ts +16 -0
  122. package/types/Cache/index.d.ts +5 -0
  123. package/types/Cache/test.d.ts +0 -0
  124. package/types/Services.d.ts +6 -0
  125. package/types/actions/actionClient.d.ts +4 -0
  126. package/types/actions/index.d.ts +1 -0
  127. package/types/actions/nodes.d.ts +4 -0
  128. package/types/client.d.ts +141 -0
  129. package/types/decorators/Cache.d.ts +1 -0
  130. package/types/decorators/CacheKey.d.ts +1 -0
  131. package/types/decorators/Invalidate.d.ts +1 -0
  132. package/types/enums/api-service.d.ts +13 -0
  133. package/types/enums/api.d.ts +5 -0
  134. package/types/enums/auth-method.d.ts +9 -0
  135. package/types/enums/authentication-factor.d.ts +6 -0
  136. package/types/enums/authenticator-type.d.ts +3 -0
  137. package/types/enums/browser.d.ts +16 -0
  138. package/types/enums/compression.d.ts +5 -0
  139. package/types/enums/credit-card.d.ts +18 -0
  140. package/types/enums/database-usage-range.d.ts +5 -0
  141. package/types/enums/email-template-locale.d.ts +133 -0
  142. package/types/enums/email-template-type.d.ts +9 -0
  143. package/types/enums/entities/EntityLimitType.d.ts +4 -0
  144. package/types/enums/entities/PropertyAttributeName.d.ts +27 -0
  145. package/types/enums/entities/PropertyCondition.d.ts +7 -0
  146. package/types/enums/entities/PropertyType.d.ts +12 -0
  147. package/types/enums/entities/PropertyValueType.d.ts +6 -0
  148. package/types/enums/entities/RowAccess.d.ts +2 -0
  149. package/types/enums/entities/ViewFilterCondition.d.ts +12 -0
  150. package/types/enums/execution-method.d.ts +8 -0
  151. package/types/enums/flag.d.ts +197 -0
  152. package/types/enums/function-usage-range.d.ts +5 -0
  153. package/types/enums/image-format.d.ts +7 -0
  154. package/types/enums/image-gravity.d.ts +11 -0
  155. package/types/enums/index-type.d.ts +5 -0
  156. package/types/enums/messaging-provider-type.d.ts +5 -0
  157. package/types/enums/name.d.ts +14 -0
  158. package/types/enums/o-auth-provider copy.d.ts +41 -0
  159. package/types/enums/o-auth-provider.d.ts +41 -0
  160. package/types/enums/password-hash.d.ts +13 -0
  161. package/types/enums/platform-type.d.ts +17 -0
  162. package/types/enums/project-usage-range.d.ts +4 -0
  163. package/types/enums/region.d.ts +4 -0
  164. package/types/enums/relation-mutate.d.ts +5 -0
  165. package/types/enums/relationship-type.d.ts +6 -0
  166. package/types/enums/resource-type.d.ts +4 -0
  167. package/types/enums/runtime.d.ts +48 -0
  168. package/types/enums/s-m-t-p-secure.d.ts +3 -0
  169. package/types/enums/shared/ApplicationLayout.d.ts +4 -0
  170. package/types/enums/shared/Colors.d.ts +24 -0
  171. package/types/enums/shared/InputType.d.ts +6 -0
  172. package/types/enums/shared/Periodicity.d.ts +7 -0
  173. package/types/enums/shared/SvgIcon.d.ts +37 -0
  174. package/types/enums/shared/Theme.d.ts +4 -0
  175. package/types/enums/sms-template-locale.d.ts +133 -0
  176. package/types/enums/sms-template-type.d.ts +6 -0
  177. package/types/enums/smtp-encryption.d.ts +5 -0
  178. package/types/enums/storage-usage-range.d.ts +5 -0
  179. package/types/enums/subscriptions/PricingModel.d.ts +11 -0
  180. package/types/enums/subscriptions/SubscriptionBillingPeriod.d.ts +10 -0
  181. package/types/enums/subscriptions/SubscriptionFeatureLimitType.d.ts +10 -0
  182. package/types/enums/subscriptions/SubscriptionPriceType.d.ts +7 -0
  183. package/types/enums/tenants/LinkedAccountStatus.d.ts +5 -0
  184. package/types/enums/tenants/TenantUserJoined.d.ts +6 -0
  185. package/types/enums/tenants/TenantUserStatus.d.ts +6 -0
  186. package/types/enums/tenants/TenantUserType.d.ts +5 -0
  187. package/types/enums/user-usage-range.d.ts +5 -0
  188. package/types/getAppcondaClient.d.ts +2 -0
  189. package/types/getSDKForCurrentUser.d.ts +33 -0
  190. package/types/id.d.ts +20 -0
  191. package/types/index.d.ts +39 -0
  192. package/types/inputFile.d.ts +6 -0
  193. package/types/lib/Registry/Registry.d.ts +38 -0
  194. package/types/lib/Registry/index.d.ts +1 -0
  195. package/types/models.d.ts +3272 -0
  196. package/types/permission.d.ts +43 -0
  197. package/types/query.d.ts +194 -0
  198. package/types/role.d.ts +70 -0
  199. package/types/service-client.d.ts +7 -0
  200. package/types/service.d.ts +11 -0
  201. package/types/services/account.d.ts +530 -0
  202. package/types/services/acl.d.ts +28 -0
  203. package/types/services/applets.d.ts +9 -0
  204. package/types/services/assistant.d.ts +14 -0
  205. package/types/services/avatars.d.ts +115 -0
  206. package/types/services/community.d.ts +19 -0
  207. package/types/services/configuration.d.ts +5 -0
  208. package/types/services/console.d.ts +15 -0
  209. package/types/services/databases.d.ts +613 -0
  210. package/types/services/functions.d.ts +319 -0
  211. package/types/services/graphql.d.ts +25 -0
  212. package/types/services/health.d.ts +231 -0
  213. package/types/services/locale.d.ts +80 -0
  214. package/types/services/messaging.d.ts +685 -0
  215. package/types/services/migrations.d.ts +185 -0
  216. package/types/services/node.d.ts +5 -0
  217. package/types/services/permissions.d.ts +20 -0
  218. package/types/services/pricing.d.ts +15 -0
  219. package/types/services/project.d.ts +70 -0
  220. package/types/services/projects.d.ts +542 -0
  221. package/types/services/proxy.d.ts +59 -0
  222. package/types/services/roles.d.ts +19 -0
  223. package/types/services/schema.d.ts +17 -0
  224. package/types/services/storage.d.ts +189 -0
  225. package/types/services/subscription-product.d.ts +77 -0
  226. package/types/services/subscription.d.ts +15 -0
  227. package/types/services/teams.d.ts +167 -0
  228. package/types/services/tenant-subscription.d.ts +12 -0
  229. package/types/services/tenant.d.ts +32 -0
  230. package/types/services/users.d.ts +499 -0
  231. package/types/services/vcs.d.ts +108 -0
  232. package/types/services/waitlist.d.ts +5 -0
  233. package/dist/cjs/sdk.js +0 -13300
  234. package/dist/cjs/sdk.js.map +0 -1
  235. package/dist/esm/sdk.js +0 -13278
  236. package/dist/esm/sdk.js.map +0 -1
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,102 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const glob = require('glob');
4
+ export class Filesystem {
5
+ constructor(path) {
6
+ this.path = '';
7
+ this.path = path;
8
+ }
9
+ delWithStart(pattern) {
10
+ throw new Error("Method not implemented.");
11
+ }
12
+ async load(key, ttl, hash = '') {
13
+ const file = this.getPath(key);
14
+ if (fs.existsSync(file) && (fs.statSync(file).mtime.getTime() + ttl * 1000 > Date.now())) {
15
+ return fs.readFileSync(file, 'utf8');
16
+ }
17
+ return false;
18
+ }
19
+ async save(key, data, hash = '') {
20
+ if (!data) {
21
+ return false;
22
+ }
23
+ const file = this.getPath(key);
24
+ const dir = path.dirname(file);
25
+ try {
26
+ if (!fs.existsSync(dir)) {
27
+ fs.mkdirSync(dir, { recursive: true });
28
+ }
29
+ fs.writeFileSync(file, data, { flag: 'w' });
30
+ return data;
31
+ }
32
+ catch (e) {
33
+ throw new Error(e.message);
34
+ }
35
+ }
36
+ async list(key) {
37
+ return [];
38
+ }
39
+ async purge(key, hash = '') {
40
+ const file = this.getPath(key);
41
+ if (fs.existsSync(file)) {
42
+ fs.unlinkSync(file);
43
+ return true;
44
+ }
45
+ return false;
46
+ }
47
+ async flush() {
48
+ return this.deleteDirectory(this.path);
49
+ }
50
+ async ping() {
51
+ return fs.existsSync(this.path) && fs.accessSync(this.path, fs.constants.W_OK | fs.constants.R_OK);
52
+ }
53
+ async getSize() {
54
+ try {
55
+ return this.getDirectorySize(path.dirname(this.path));
56
+ }
57
+ catch {
58
+ return 0;
59
+ }
60
+ }
61
+ getDirectorySize(dir) {
62
+ let size = 0;
63
+ const normalizedPath = path.join(dir, '*');
64
+ const paths = glob.sync(normalizedPath, { nodir: false });
65
+ if (!paths) {
66
+ return size;
67
+ }
68
+ for (const p of paths) {
69
+ if (fs.statSync(p).isFile()) {
70
+ size += fs.statSync(p).size;
71
+ }
72
+ else if (fs.statSync(p).isDirectory()) {
73
+ size += this.getDirectorySize(p);
74
+ }
75
+ }
76
+ return size;
77
+ }
78
+ getPath(filename) {
79
+ return path.join(this.path, filename);
80
+ }
81
+ deleteDirectory(dirPath) {
82
+ if (!fs.statSync(dirPath).isDirectory()) {
83
+ throw new Error(`${dirPath} must be a directory`);
84
+ }
85
+ if (!dirPath.endsWith('/')) {
86
+ dirPath += '/';
87
+ }
88
+ const files = glob.sync(dirPath + '*', { mark: true });
89
+ if (!files) {
90
+ throw new Error('Error happened during glob');
91
+ }
92
+ for (const file of files) {
93
+ if (fs.statSync(file).isDirectory()) {
94
+ this.deleteDirectory(file);
95
+ }
96
+ else {
97
+ fs.unlinkSync(file);
98
+ }
99
+ }
100
+ return fs.rmdirSync(dirPath);
101
+ }
102
+ }
@@ -0,0 +1,46 @@
1
+ export class Memory {
2
+ constructor() {
3
+ this.store = {};
4
+ }
5
+ delWithStart(pattern) {
6
+ throw new Error("Method not implemented.");
7
+ }
8
+ async load(key, ttl, hash = '') {
9
+ if (key && this.store[key]) {
10
+ const saved = this.store[key];
11
+ return (saved.time + ttl > Date.now() / 1000) ? saved.data : false;
12
+ }
13
+ return false;
14
+ }
15
+ async save(key, data, hash = '') {
16
+ if (!key || !data) {
17
+ return false;
18
+ }
19
+ const saved = {
20
+ time: Date.now() / 1000,
21
+ data: data,
22
+ };
23
+ this.store[key] = saved;
24
+ return data;
25
+ }
26
+ async list(key) {
27
+ return [];
28
+ }
29
+ async purge(key, hash = '') {
30
+ if (key && this.store[key]) {
31
+ delete this.store[key];
32
+ return true;
33
+ }
34
+ return false;
35
+ }
36
+ async flush() {
37
+ this.store = {};
38
+ return true;
39
+ }
40
+ async ping() {
41
+ return true;
42
+ }
43
+ async getSize() {
44
+ return Object.keys(this.store).length;
45
+ }
46
+ }
@@ -0,0 +1,27 @@
1
+ export class None {
2
+ constructor() { }
3
+ delWithStart(pattern) {
4
+ throw new Error("Method not implemented.");
5
+ }
6
+ async load(key, ttl, hash = '') {
7
+ return false;
8
+ }
9
+ async save(key, data, hash = '') {
10
+ return false;
11
+ }
12
+ async list(key) {
13
+ return [];
14
+ }
15
+ async purge(key, hash = '') {
16
+ return true;
17
+ }
18
+ async flush() {
19
+ return true;
20
+ }
21
+ async ping() {
22
+ return true;
23
+ }
24
+ async getSize() {
25
+ return 0;
26
+ }
27
+ }
@@ -0,0 +1,79 @@
1
+ export class Redis {
2
+ constructor(redis) {
3
+ this.redis = redis;
4
+ }
5
+ async load(key, ttl, hash = '') {
6
+ if (!hash) {
7
+ hash = key;
8
+ }
9
+ return new Promise((resolve) => {
10
+ try {
11
+ this.redis.get(key).then((redisString) => {
12
+ if (!redisString) {
13
+ resolve(null);
14
+ }
15
+ const cache = JSON.parse(redisString);
16
+ if (cache != null && cache.time + ttl > Date.now() / 1000) {
17
+ resolve(cache.data);
18
+ }
19
+ else {
20
+ resolve(null);
21
+ }
22
+ })
23
+ .catch((e) => {
24
+ console.error('redis error');
25
+ });
26
+ }
27
+ catch (e) {
28
+ console.error('redis error');
29
+ }
30
+ });
31
+ }
32
+ async save(key, data, hash = '') {
33
+ if (!key || !data) {
34
+ return Promise.resolve(false);
35
+ }
36
+ if (!hash) {
37
+ hash = key;
38
+ }
39
+ const value = JSON.stringify({
40
+ time: Date.now() / 1000,
41
+ data: data,
42
+ });
43
+ return this.redis.set(key, value).then(() => data).catch(() => false);
44
+ }
45
+ list(key) {
46
+ return this.redis.hKeys(key).then((keys) => keys || []);
47
+ }
48
+ async purge(key, hash = '') {
49
+ if (hash) {
50
+ return this.redis.del(key).then((result) => !!result);
51
+ }
52
+ const result = await this.redis.del(key);
53
+ return !!result;
54
+ }
55
+ flush() {
56
+ //@ts-ignore
57
+ return this.redis.flushall().then(() => true);
58
+ }
59
+ ping() {
60
+ return this.redis.ping().then(() => true).catch(() => false);
61
+ }
62
+ getSize() {
63
+ //@ts-ignore
64
+ return this.redis.dbsize();
65
+ }
66
+ async delWithStart(pattern) {
67
+ let cur = 0;
68
+ let totalDeleted = 0;
69
+ do {
70
+ const { cursor, keys } = await this.redis.scan(cur, {
71
+ MATCH: `${pattern}:*`,
72
+ COUNT: 100, // Her taramada maksimum 100 anahtar döndür
73
+ });
74
+ cur = Number(cursor);
75
+ await Promise.all(keys.map((key) => this.redis.del(key)));
76
+ } while (cur !== 0);
77
+ return totalDeleted;
78
+ }
79
+ }
@@ -0,0 +1,72 @@
1
+ export class Sharding {
2
+ constructor(adapters) {
3
+ this.count = 0;
4
+ this.crc32Table = (() => {
5
+ let c;
6
+ const table = [];
7
+ for (let n = 0; n < 256; n++) {
8
+ c = n;
9
+ for (let k = 0; k < 8; k++) {
10
+ c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
11
+ }
12
+ table[n] = c;
13
+ }
14
+ return table;
15
+ })();
16
+ if (adapters.length === 0) {
17
+ throw new Error('No adapters provided');
18
+ }
19
+ this.count = adapters.length;
20
+ this.adapters = adapters;
21
+ }
22
+ delWithStart(pattern) {
23
+ throw new Error("Method not implemented.");
24
+ }
25
+ async load(key, ttl, hash = '') {
26
+ const adapter = this.getAdapter(key);
27
+ return await adapter.load(key, ttl, hash);
28
+ }
29
+ async save(key, data, hash = '') {
30
+ return this.getAdapter(key).save(key, data, hash);
31
+ }
32
+ async list(key) {
33
+ return this.getAdapter(key).list(key);
34
+ }
35
+ async purge(key, hash = '') {
36
+ return this.getAdapter(key).purge(key, hash);
37
+ }
38
+ async flush() {
39
+ let result = true;
40
+ for (const adapter of this.adapters) {
41
+ result = await adapter.flush() ? result : false;
42
+ }
43
+ return result;
44
+ }
45
+ async ping() {
46
+ for (const adapter of this.adapters) {
47
+ if (!adapter.ping()) {
48
+ return false;
49
+ }
50
+ }
51
+ return true;
52
+ }
53
+ async getSize() {
54
+ let size = 0;
55
+ for (const adapter of this.adapters) {
56
+ size += await adapter.getSize();
57
+ }
58
+ return size;
59
+ }
60
+ getAdapter(key) {
61
+ const hash = this.crc32(key);
62
+ const index = hash % this.count;
63
+ return this.adapters[index];
64
+ }
65
+ crc32(str) {
66
+ let crc = 0 ^ (-1);
67
+ for (let i = 0; i < str.length; i++) {
68
+ crc = (crc >>> 8) ^ this.crc32Table[(crc ^ str.charCodeAt(i)) & 0xff];
69
+ }
70
+ return (crc ^ (-1)) >>> 0;
71
+ }
72
+ }
@@ -0,0 +1,51 @@
1
+ export class Cache {
2
+ constructor(adapter) {
3
+ this.adapter = adapter;
4
+ }
5
+ constructKey(key) {
6
+ if (Array.isArray(key)) {
7
+ key = key.join(':');
8
+ }
9
+ return key;
10
+ }
11
+ static setCaseSensitivity(value) {
12
+ return this.caseSensitive = value;
13
+ }
14
+ async load(key, ttl = 60 * 60 * 24, hash = '') {
15
+ key = this.constructKey(key);
16
+ key = Cache.caseSensitive ? key : key.toLowerCase();
17
+ hash = Cache.caseSensitive ? hash : hash.toLowerCase();
18
+ return await this.adapter.load(key, ttl, hash);
19
+ }
20
+ async save(key, data, hash = '') {
21
+ key = this.constructKey(key);
22
+ key = Cache.caseSensitive ? key : key.toLowerCase();
23
+ hash = Cache.caseSensitive ? hash : hash.toLowerCase();
24
+ return this.adapter.save(key, data, hash);
25
+ }
26
+ async list(key) {
27
+ key = this.constructKey(key);
28
+ key = Cache.caseSensitive ? key : key.toLowerCase();
29
+ return this.adapter.list(key);
30
+ }
31
+ async purge(key, hash = '') {
32
+ key = this.constructKey(key);
33
+ key = Cache.caseSensitive ? key : key.toLowerCase();
34
+ hash = Cache.caseSensitive ? hash : hash.toLowerCase();
35
+ return this.adapter.purge(key, hash);
36
+ }
37
+ async flush() {
38
+ return this.adapter.flush();
39
+ }
40
+ async ping() {
41
+ return this.adapter.ping();
42
+ }
43
+ async getSize() {
44
+ return this.adapter.getSize();
45
+ }
46
+ async delWithStart(keys) {
47
+ const pattern = this.constructKey(keys);
48
+ return this.adapter.delWithStart(pattern);
49
+ }
50
+ }
51
+ Cache.caseSensitive = false;
@@ -0,0 +1,5 @@
1
+ export * from './Cache';
2
+ export * from './Adapters/None';
3
+ export * from './Adapters/Redis';
4
+ export * from './Adapters/Sharding';
5
+ export * from './Adapters/Memory';
File without changes
@@ -0,0 +1,28 @@
1
+ import { Registry } from "@/lib/Registry";
2
+ import { createClient } from 'redis';
3
+ import { Redis } from "./Cache/Adapters/Redis";
4
+ import { Cache } from "./Cache";
5
+ export const registry = new Registry();
6
+ registry.set('cache', () => {
7
+ const client = createClient({
8
+ socket: {
9
+ host: process.env._APP_REDIS_HOST ?? 'localhost',
10
+ port: Number.parseInt(process.env._APP_REDIS_PORT ?? '6379'),
11
+ },
12
+ password: undefined,
13
+ });
14
+ // Bağlantı hatalarını ele al
15
+ client.on('error', (err) => {
16
+ console.error('Redis Client Error', err);
17
+ });
18
+ // Connect to Redis
19
+ client.connect();
20
+ const redisAdapter = new Redis(client);
21
+ const cacheProvider = new Cache(redisAdapter);
22
+ return cacheProvider;
23
+ });
24
+ export class Services {
25
+ static get Cache() {
26
+ return registry.get('cache');
27
+ }
28
+ }
@@ -0,0 +1,35 @@
1
+ import { DEFAULT_SERVER_ERROR_MESSAGE, createSafeActionClient } from "next-safe-action";
2
+ export const actionClient = createSafeActionClient({
3
+ handleServerError(e) {
4
+ /* if (
5
+ e instanceof ResourceNotFoundError ||
6
+ e instanceof AuthorizationError ||
7
+ e instanceof InvalidInputError ||
8
+ e instanceof UnknownError ||
9
+ e instanceof AuthenticationError ||
10
+ e instanceof OperationNotAllowedError ||
11
+ e instanceof AppcondaException
12
+ ) {
13
+ return e.message;
14
+ } */
15
+ // eslint-disable-next-line no-console -- This error needs to be logged for debugging server-side errors
16
+ console.error("SERVER ERROR: ", e);
17
+ return DEFAULT_SERVER_ERROR_MESSAGE;
18
+ },
19
+ });
20
+ /* export const authenticatedActionClient = actionClient.use(async ({ next }) => {
21
+ const session = await getServerSession(authOptions);
22
+ if (!session?.user) {
23
+ throw new AuthenticationError("Not authenticated");
24
+ }
25
+
26
+ const userId = session.user.id;
27
+
28
+ const user = await getUser(userId);
29
+ if (!user) {
30
+ throw new AuthorizationError("User not found");
31
+ }
32
+
33
+ return next({ ctx: { user } });
34
+ });
35
+ */
@@ -0,0 +1 @@
1
+ export * from './nodes';
@@ -0,0 +1,9 @@
1
+ 'use server';
2
+ import { actionClient } from "./actionClient";
3
+ import { getSDKForCurrentUser } from "@/getSDKForCurrentUser";
4
+ export const getAllNodesAction = actionClient
5
+ // .schema(listModelsSchema)
6
+ .action(async ({ parsedInput }) => {
7
+ const { node } = await getSDKForCurrentUser();
8
+ return await node.GetAllNodes();
9
+ });