@appconda/nextjs 1.0.33 → 1.0.35
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/decorators/Cache.js +1 -1
- package/dist/decorators/Invalidate.js +1 -1
- package/dist/{Cache → lib/Cache}/Adapters/Filesystem.js +3 -3
- package/dist/{Cache → lib/Cache}/Adapters/Memory.js +3 -3
- package/dist/{Cache → lib/Cache}/Adapters/None.js +3 -3
- package/dist/{Cache → lib/Cache}/Adapters/Sharding.js +3 -3
- package/dist/{Cache → lib/Cache}/index.d.ts +0 -1
- package/dist/{Cache → lib/Cache}/index.js +0 -1
- package/{types → dist/lib}/Services.d.ts +1 -1
- package/dist/lib/Services.js +13 -0
- package/dist/modules/waitlist/service.js +1 -1
- package/dist/services/node.js +16 -0
- package/package.json +2 -2
- package/publish.sh +1 -1
- package/src/decorators/Cache.ts +103 -0
- package/src/decorators/CacheKey.ts +9 -0
- package/src/decorators/Invalidate.ts +69 -0
- package/{types/Cache/Adapter.d.ts → src/lib/Cache/Adapter.ts} +3 -2
- package/src/lib/Cache/Adapters/Filesystem.ts +126 -0
- package/src/lib/Cache/Adapters/Memory.ts +58 -0
- package/src/lib/Cache/Adapters/None.ts +36 -0
- package/src/lib/Cache/Adapters/Sharding.ts +88 -0
- package/src/lib/Cache/Cache.ts +75 -0
- package/{types/Cache/index.d.ts → src/lib/Cache/index.ts} +1 -2
- package/src/lib/Services.ts +25 -0
- package/src/modules/waitlist/action.ts +2 -0
- package/src/modules/waitlist/service.ts +1 -1
- package/src/services/node.ts +2 -0
- package/dist/Cache/Adapters/Filesystem.d.ts +0 -16
- package/dist/Cache/Adapters/Memory.d.ts +0 -18
- package/dist/Cache/Adapters/None.d.ts +0 -12
- package/dist/Cache/Adapters/Redis.d.ts +0 -14
- package/dist/Cache/Adapters/Redis.js +0 -79
- package/dist/Services.d.ts +0 -7
- package/dist/Services.js +0 -29
- package/dist/services/waitlist.d.ts +0 -5
- package/dist/services/waitlist.js +0 -11
- package/types/Cache/Adapters/Redis.d.ts +0 -14
- package/types/Cache/Adapters/Sharding.d.ts +0 -17
- package/types/Cache/Cache.d.ts +0 -16
- package/types/actions/actionClient.d.ts +0 -4
- package/types/actions/index.d.ts +0 -1
- package/types/actions/nodes.d.ts +0 -4
- package/types/client.d.ts +0 -141
- package/types/decorators/Cache.d.ts +0 -1
- package/types/decorators/CacheKey.d.ts +0 -1
- package/types/decorators/Invalidate.d.ts +0 -1
- package/types/enums/api-service.d.ts +0 -13
- package/types/enums/api.d.ts +0 -5
- package/types/enums/auth-method.d.ts +0 -9
- package/types/enums/authentication-factor.d.ts +0 -6
- package/types/enums/authenticator-type.d.ts +0 -3
- package/types/enums/browser.d.ts +0 -16
- package/types/enums/compression.d.ts +0 -5
- package/types/enums/credit-card.d.ts +0 -18
- package/types/enums/database-usage-range.d.ts +0 -5
- package/types/enums/email-template-locale.d.ts +0 -133
- package/types/enums/email-template-type.d.ts +0 -9
- package/types/enums/entities/EntityLimitType.d.ts +0 -4
- package/types/enums/entities/PropertyAttributeName.d.ts +0 -27
- package/types/enums/entities/PropertyCondition.d.ts +0 -7
- package/types/enums/entities/PropertyType.d.ts +0 -12
- package/types/enums/entities/PropertyValueType.d.ts +0 -6
- package/types/enums/entities/RowAccess.d.ts +0 -2
- package/types/enums/entities/ViewFilterCondition.d.ts +0 -12
- package/types/enums/execution-method.d.ts +0 -8
- package/types/enums/flag.d.ts +0 -197
- package/types/enums/function-usage-range.d.ts +0 -5
- package/types/enums/image-format.d.ts +0 -7
- package/types/enums/image-gravity.d.ts +0 -11
- package/types/enums/index-type.d.ts +0 -5
- package/types/enums/messaging-provider-type.d.ts +0 -5
- package/types/enums/name.d.ts +0 -14
- package/types/enums/o-auth-provider copy.d.ts +0 -41
- package/types/enums/o-auth-provider.d.ts +0 -41
- package/types/enums/password-hash.d.ts +0 -13
- package/types/enums/platform-type.d.ts +0 -17
- package/types/enums/project-usage-range.d.ts +0 -4
- package/types/enums/region.d.ts +0 -4
- package/types/enums/relation-mutate.d.ts +0 -5
- package/types/enums/relationship-type.d.ts +0 -6
- package/types/enums/resource-type.d.ts +0 -4
- package/types/enums/runtime.d.ts +0 -48
- package/types/enums/s-m-t-p-secure.d.ts +0 -3
- package/types/enums/shared/ApplicationLayout.d.ts +0 -4
- package/types/enums/shared/Colors.d.ts +0 -24
- package/types/enums/shared/InputType.d.ts +0 -6
- package/types/enums/shared/Periodicity.d.ts +0 -7
- package/types/enums/shared/SvgIcon.d.ts +0 -37
- package/types/enums/shared/Theme.d.ts +0 -4
- package/types/enums/sms-template-locale.d.ts +0 -133
- package/types/enums/sms-template-type.d.ts +0 -6
- package/types/enums/smtp-encryption.d.ts +0 -5
- package/types/enums/storage-usage-range.d.ts +0 -5
- package/types/enums/subscriptions/PricingModel.d.ts +0 -11
- package/types/enums/subscriptions/SubscriptionBillingPeriod.d.ts +0 -10
- package/types/enums/subscriptions/SubscriptionFeatureLimitType.d.ts +0 -10
- package/types/enums/subscriptions/SubscriptionPriceType.d.ts +0 -7
- package/types/enums/tenants/LinkedAccountStatus.d.ts +0 -5
- package/types/enums/tenants/TenantUserJoined.d.ts +0 -6
- package/types/enums/tenants/TenantUserStatus.d.ts +0 -6
- package/types/enums/tenants/TenantUserType.d.ts +0 -5
- package/types/enums/user-usage-range.d.ts +0 -5
- package/types/getAppcondaClient.d.ts +0 -2
- package/types/getSDKForCurrentUser.d.ts +0 -33
- package/types/id.d.ts +0 -20
- package/types/index.d.ts +0 -39
- package/types/inputFile.d.ts +0 -6
- package/types/lib/Registry/Registry.d.ts +0 -38
- package/types/lib/Registry/index.d.ts +0 -1
- package/types/models.d.ts +0 -3272
- package/types/permission.d.ts +0 -43
- package/types/query.d.ts +0 -194
- package/types/role.d.ts +0 -70
- package/types/service-client.d.ts +0 -7
- package/types/service.d.ts +0 -11
- package/types/services/account.d.ts +0 -530
- package/types/services/acl.d.ts +0 -28
- package/types/services/applets.d.ts +0 -9
- package/types/services/assistant.d.ts +0 -14
- package/types/services/avatars.d.ts +0 -115
- package/types/services/community.d.ts +0 -19
- package/types/services/configuration.d.ts +0 -5
- package/types/services/console.d.ts +0 -15
- package/types/services/databases.d.ts +0 -613
- package/types/services/functions.d.ts +0 -319
- package/types/services/graphql.d.ts +0 -25
- package/types/services/health.d.ts +0 -231
- package/types/services/locale.d.ts +0 -80
- package/types/services/messaging.d.ts +0 -685
- package/types/services/migrations.d.ts +0 -185
- package/types/services/node.d.ts +0 -5
- package/types/services/permissions.d.ts +0 -20
- package/types/services/pricing.d.ts +0 -15
- package/types/services/project.d.ts +0 -70
- package/types/services/projects.d.ts +0 -542
- package/types/services/proxy.d.ts +0 -59
- package/types/services/roles.d.ts +0 -19
- package/types/services/schema.d.ts +0 -17
- package/types/services/storage.d.ts +0 -189
- package/types/services/subscription-product.d.ts +0 -77
- package/types/services/subscription.d.ts +0 -15
- package/types/services/teams.d.ts +0 -167
- package/types/services/tenant-subscription.d.ts +0 -12
- package/types/services/tenant.d.ts +0 -32
- package/types/services/users.d.ts +0 -499
- package/types/services/vcs.d.ts +0 -108
- package/types/services/waitlist.d.ts +0 -5
- package/dist/{Cache → lib/Cache}/Adapter.d.ts +0 -0
- package/dist/{Cache → lib/Cache}/Adapter.js +0 -0
- package/{types → dist/lib}/Cache/Adapters/Filesystem.d.ts +1 -1
- package/{types → dist/lib}/Cache/Adapters/Memory.d.ts +1 -1
- package/{types → dist/lib}/Cache/Adapters/None.d.ts +1 -1
- package/dist/{Cache → lib/Cache}/Adapters/Sharding.d.ts +1 -1
- /package/dist/{Cache → lib/Cache}/Cache.d.ts +0 -0
- /package/dist/{Cache → lib/Cache}/Cache.js +0 -0
- /package/dist/{Cache → lib/Cache}/test.d.ts +0 -0
- /package/dist/{Cache → lib/Cache}/test.js +0 -0
- /package/{types/Cache/test.d.ts → src/lib/Cache/test.ts} +0 -0
@@ -0,0 +1,88 @@
|
|
1
|
+
import { Adapter } from "../Adapter";
|
2
|
+
|
3
|
+
export class Sharding implements Adapter {
|
4
|
+
protected adapters: Adapter[];
|
5
|
+
protected count: number = 0;
|
6
|
+
|
7
|
+
constructor(adapters: Adapter[]) {
|
8
|
+
if (adapters.length === 0) {
|
9
|
+
throw new Error('No adapters provided');
|
10
|
+
}
|
11
|
+
|
12
|
+
this.count = adapters.length;
|
13
|
+
this.adapters = adapters;
|
14
|
+
}
|
15
|
+
|
16
|
+
async load(key: string, ttl: number, hash: string = ''): Promise<any> {
|
17
|
+
const adapter = this.getAdapter(key);
|
18
|
+
return await adapter.load(key, ttl, hash);
|
19
|
+
}
|
20
|
+
|
21
|
+
async save(key: string, data: any, hash: string = ''): Promise<boolean | string | any[]> {
|
22
|
+
return this.getAdapter(key).save(key, data, hash);
|
23
|
+
}
|
24
|
+
|
25
|
+
async list(key: string): Promise<string[]> {
|
26
|
+
return this.getAdapter(key).list(key);
|
27
|
+
}
|
28
|
+
|
29
|
+
async purge(key: string, hash: string = ''): Promise<boolean> {
|
30
|
+
return this.getAdapter(key).purge(key, hash);
|
31
|
+
}
|
32
|
+
|
33
|
+
async flush(): Promise<boolean> {
|
34
|
+
let result = true;
|
35
|
+
for (const adapter of this.adapters) {
|
36
|
+
result = await adapter.flush() ? result : false;
|
37
|
+
}
|
38
|
+
return result;
|
39
|
+
}
|
40
|
+
|
41
|
+
async ping(): Promise<boolean> {
|
42
|
+
for (const adapter of this.adapters) {
|
43
|
+
if (!adapter.ping()) {
|
44
|
+
return false;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
return true;
|
48
|
+
}
|
49
|
+
|
50
|
+
async getSize(): Promise<number> {
|
51
|
+
let size = 0;
|
52
|
+
for (const adapter of this.adapters) {
|
53
|
+
size += await adapter.getSize();
|
54
|
+
}
|
55
|
+
return size;
|
56
|
+
}
|
57
|
+
|
58
|
+
protected getAdapter(key: string): Adapter {
|
59
|
+
const hash = this.crc32(key);
|
60
|
+
const index = hash % this.count;
|
61
|
+
return this.adapters[index];
|
62
|
+
}
|
63
|
+
|
64
|
+
private crc32(str: string): number {
|
65
|
+
let crc = 0 ^ (-1);
|
66
|
+
for (let i = 0; i < str.length; i++) {
|
67
|
+
crc = (crc >>> 8) ^ this.crc32Table[(crc ^ str.charCodeAt(i)) & 0xff];
|
68
|
+
}
|
69
|
+
return (crc ^ (-1)) >>> 0;
|
70
|
+
}
|
71
|
+
|
72
|
+
async delWithStart(pattern: string): Promise<number> {
|
73
|
+
return 0;
|
74
|
+
}
|
75
|
+
|
76
|
+
private crc32Table = (() => {
|
77
|
+
let c: number;
|
78
|
+
const table: number[] = [];
|
79
|
+
for (let n = 0; n < 256; n++) {
|
80
|
+
c = n;
|
81
|
+
for (let k = 0; k < 8; k++) {
|
82
|
+
c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
|
83
|
+
}
|
84
|
+
table[n] = c;
|
85
|
+
}
|
86
|
+
return table;
|
87
|
+
})();
|
88
|
+
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import { Adapter } from "./Adapter";
|
2
|
+
|
3
|
+
|
4
|
+
export class Cache {
|
5
|
+
private adapter: Adapter;
|
6
|
+
public static caseSensitive: boolean = false;
|
7
|
+
|
8
|
+
constructor(adapter: Adapter) {
|
9
|
+
this.adapter = adapter;
|
10
|
+
}
|
11
|
+
|
12
|
+
private constructKey(key: any): string {
|
13
|
+
if (Array.isArray(key)) {
|
14
|
+
key = key.join(':');
|
15
|
+
}
|
16
|
+
|
17
|
+
return key;
|
18
|
+
}
|
19
|
+
|
20
|
+
public static setCaseSensitivity(value: boolean): boolean {
|
21
|
+
return this.caseSensitive = value;
|
22
|
+
}
|
23
|
+
|
24
|
+
public async load(key: string | string[], ttl: number = 60 * 60 * 24, hash: string = ''): Promise<any> {
|
25
|
+
key = this.constructKey(key);
|
26
|
+
key = Cache.caseSensitive ? key : key.toLowerCase();
|
27
|
+
hash = Cache.caseSensitive ? hash : hash.toLowerCase();
|
28
|
+
|
29
|
+
return await this.adapter.load(key, ttl, hash);
|
30
|
+
}
|
31
|
+
|
32
|
+
public async save(key: string | string[], data: any, hash: string = ''): Promise<boolean | string | any[]> {
|
33
|
+
|
34
|
+
key = this.constructKey(key);
|
35
|
+
|
36
|
+
key = Cache.caseSensitive ? key : key.toLowerCase();
|
37
|
+
hash = Cache.caseSensitive ? hash : hash.toLowerCase();
|
38
|
+
|
39
|
+
return this.adapter.save(key, data, hash);
|
40
|
+
}
|
41
|
+
|
42
|
+
public async list(key: string | string[]): Promise<string[]> {
|
43
|
+
key = this.constructKey(key);
|
44
|
+
key = Cache.caseSensitive ? key : key.toLowerCase();
|
45
|
+
|
46
|
+
return this.adapter.list(key);
|
47
|
+
}
|
48
|
+
|
49
|
+
public async purge(key: string | string[], hash: string = ''): Promise<boolean> {
|
50
|
+
|
51
|
+
key = this.constructKey(key);
|
52
|
+
|
53
|
+
key = Cache.caseSensitive ? key : key.toLowerCase();
|
54
|
+
hash = Cache.caseSensitive ? hash : hash.toLowerCase();
|
55
|
+
|
56
|
+
return this.adapter.purge(key, hash);
|
57
|
+
}
|
58
|
+
|
59
|
+
public async flush(): Promise<boolean> {
|
60
|
+
return this.adapter.flush();
|
61
|
+
}
|
62
|
+
|
63
|
+
public async ping(): Promise<boolean> {
|
64
|
+
return this.adapter.ping();
|
65
|
+
}
|
66
|
+
|
67
|
+
public async getSize(): Promise<number> {
|
68
|
+
return this.adapter.getSize();
|
69
|
+
}
|
70
|
+
|
71
|
+
public async delWithStart(keys: string | string[]): Promise<number> {
|
72
|
+
const pattern = this.constructKey(keys);
|
73
|
+
return this.adapter.delWithStart(pattern);
|
74
|
+
}
|
75
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { Cache, Memory } from "./Cache";
|
2
|
+
import { Registry } from "./Registry";
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
export const registry = new Registry();
|
8
|
+
|
9
|
+
registry.set('cache', () => {
|
10
|
+
|
11
|
+
|
12
|
+
const memoryAdapter = new Memory();
|
13
|
+
|
14
|
+
const cacheProvider = new Cache(memoryAdapter);
|
15
|
+
|
16
|
+
return cacheProvider;
|
17
|
+
|
18
|
+
})
|
19
|
+
|
20
|
+
export class Services {
|
21
|
+
public static get Cache(): Cache {
|
22
|
+
return registry.get('cache');
|
23
|
+
}
|
24
|
+
|
25
|
+
}
|
@@ -9,7 +9,7 @@ export class Waitlist extends ServiceClient {
|
|
9
9
|
|
10
10
|
public async ListWiatlistSignups(waitlistId: string): Promise<any[]> {
|
11
11
|
const payload: Payload = {};
|
12
|
-
payload['waitlistId']
|
12
|
+
payload['waitlistId'] = waitlistId;
|
13
13
|
return await this.actionCall('ListWiatlistSignups', payload);
|
14
14
|
}
|
15
15
|
|
package/src/services/node.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
|
2
|
+
import { Cache } from "decorators/Cache";
|
2
3
|
import { Payload } from "../client";
|
3
4
|
import { ServiceClient } from "../service-client";
|
4
5
|
|
@@ -7,6 +8,7 @@ export class Node extends ServiceClient {
|
|
7
8
|
return 'com.appconda.service.node';
|
8
9
|
}
|
9
10
|
|
11
|
+
@Cache()
|
10
12
|
public async GetAllNodes(isPublic?: boolean): Promise<any[]> {
|
11
13
|
const payload: Payload = {};
|
12
14
|
return await this.actionCall('GetAllNodes', payload);
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { Adapter } from "../Adapter";
|
2
|
-
export declare class Filesystem implements Adapter {
|
3
|
-
protected path: string;
|
4
|
-
constructor(path: string);
|
5
|
-
delWithStart(pattern: string): Promise<number>;
|
6
|
-
load(key: string, ttl: number, hash?: string): Promise<any>;
|
7
|
-
save(key: string, data: any, hash?: string): Promise<boolean | string | any[]>;
|
8
|
-
list(key: string): Promise<string[]>;
|
9
|
-
purge(key: string, hash?: string): Promise<boolean>;
|
10
|
-
flush(): Promise<boolean>;
|
11
|
-
ping(): Promise<boolean>;
|
12
|
-
getSize(): Promise<number>;
|
13
|
-
private getDirectorySize;
|
14
|
-
getPath(filename: string): string;
|
15
|
-
protected deleteDirectory(dirPath: string): boolean;
|
16
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { Adapter } from "../Adapter";
|
2
|
-
export declare class Memory implements Adapter {
|
3
|
-
store: {
|
4
|
-
[key: string]: {
|
5
|
-
time: number;
|
6
|
-
data: any;
|
7
|
-
};
|
8
|
-
};
|
9
|
-
constructor();
|
10
|
-
delWithStart(pattern: string): Promise<number>;
|
11
|
-
load(key: string, ttl: number, hash?: string): Promise<any>;
|
12
|
-
save(key: string, data: any, hash?: string): Promise<boolean | string | any[]>;
|
13
|
-
list(key: string): Promise<string[]>;
|
14
|
-
purge(key: string, hash?: string): Promise<boolean>;
|
15
|
-
flush(): Promise<boolean>;
|
16
|
-
ping(): Promise<boolean>;
|
17
|
-
getSize(): Promise<number>;
|
18
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { Adapter } from "../Adapter";
|
2
|
-
export declare class None implements Adapter {
|
3
|
-
constructor();
|
4
|
-
delWithStart(pattern: string): Promise<number>;
|
5
|
-
load(key: string, ttl: number, hash?: string): Promise<any>;
|
6
|
-
save(key: string, data: any, hash?: string): Promise<boolean | string | any[]>;
|
7
|
-
list(key: string): Promise<string[]>;
|
8
|
-
purge(key: string, hash?: string): Promise<boolean>;
|
9
|
-
flush(): Promise<boolean>;
|
10
|
-
ping(): Promise<boolean>;
|
11
|
-
getSize(): Promise<number>;
|
12
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { RedisClientType } from 'redis';
|
2
|
-
import { Adapter } from "../Adapter";
|
3
|
-
export declare class Redis implements Adapter {
|
4
|
-
protected redis: RedisClientType;
|
5
|
-
constructor(redis: RedisClientType);
|
6
|
-
load(key: string, ttl: number, hash?: string): Promise<any>;
|
7
|
-
save(key: string, data: any, hash?: string): Promise<boolean | string | any[]>;
|
8
|
-
list(key: string): Promise<string[]>;
|
9
|
-
purge(key: string, hash?: string): Promise<boolean>;
|
10
|
-
flush(): Promise<boolean>;
|
11
|
-
ping(): Promise<boolean>;
|
12
|
-
getSize(): Promise<number>;
|
13
|
-
delWithStart(pattern: string): Promise<number>;
|
14
|
-
}
|
@@ -1,79 +0,0 @@
|
|
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
|
-
}
|
package/dist/Services.d.ts
DELETED
package/dist/Services.js
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
import { Registry } from "./lib/Registry";
|
2
|
-
import { createClient } from 'redis';
|
3
|
-
import { Redis } from "./Cache/Adapters/Redis";
|
4
|
-
import { Cache } from "./Cache";
|
5
|
-
import 'server-only';
|
6
|
-
export const registry = new Registry();
|
7
|
-
registry.set('cache', () => {
|
8
|
-
const client = createClient({
|
9
|
-
socket: {
|
10
|
-
host: process.env._APP_REDIS_HOST ?? 'localhost',
|
11
|
-
port: Number.parseInt(process.env._APP_REDIS_PORT ?? '6379'),
|
12
|
-
},
|
13
|
-
password: undefined,
|
14
|
-
});
|
15
|
-
// Bağlantı hatalarını ele al
|
16
|
-
client.on('error', (err) => {
|
17
|
-
console.error('Redis Client Error', err);
|
18
|
-
});
|
19
|
-
// Connect to Redis
|
20
|
-
client.connect();
|
21
|
-
const redisAdapter = new Redis(client);
|
22
|
-
const cacheProvider = new Cache(redisAdapter);
|
23
|
-
return cacheProvider;
|
24
|
-
});
|
25
|
-
export class Services {
|
26
|
-
static get Cache() {
|
27
|
-
return registry.get('cache');
|
28
|
-
}
|
29
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { ServiceClient } from "../service-client";
|
2
|
-
export class _Waitlist extends ServiceClient {
|
3
|
-
getServiceName() {
|
4
|
-
return 'com.appconda.service.waitlist';
|
5
|
-
}
|
6
|
-
async ListWiatlistSignups(waitlistId) {
|
7
|
-
const payload = {};
|
8
|
-
payload['waitlistId'];
|
9
|
-
return await this.actionCall('ListWiatlistSignups', payload);
|
10
|
-
}
|
11
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { RedisClientType } from 'redis';
|
2
|
-
import { Adapter } from "../Adapter";
|
3
|
-
export declare class Redis implements Adapter {
|
4
|
-
protected redis: RedisClientType;
|
5
|
-
constructor(redis: RedisClientType);
|
6
|
-
load(key: string, ttl: number, hash?: string): Promise<any>;
|
7
|
-
save(key: string, data: any, hash?: string): Promise<boolean | string | any[]>;
|
8
|
-
list(key: string): Promise<string[]>;
|
9
|
-
purge(key: string, hash?: string): Promise<boolean>;
|
10
|
-
flush(): Promise<boolean>;
|
11
|
-
ping(): Promise<boolean>;
|
12
|
-
getSize(): Promise<number>;
|
13
|
-
delWithStart(pattern: string): Promise<number>;
|
14
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { Adapter } from "../Adapter";
|
2
|
-
export declare class Sharding implements Adapter {
|
3
|
-
protected adapters: Adapter[];
|
4
|
-
protected count: number;
|
5
|
-
constructor(adapters: Adapter[]);
|
6
|
-
delWithStart(pattern: string): Promise<number>;
|
7
|
-
load(key: string, ttl: number, hash?: string): Promise<any>;
|
8
|
-
save(key: string, data: any, hash?: string): Promise<boolean | string | any[]>;
|
9
|
-
list(key: string): Promise<string[]>;
|
10
|
-
purge(key: string, hash?: string): Promise<boolean>;
|
11
|
-
flush(): Promise<boolean>;
|
12
|
-
ping(): Promise<boolean>;
|
13
|
-
getSize(): Promise<number>;
|
14
|
-
protected getAdapter(key: string): Adapter;
|
15
|
-
private crc32;
|
16
|
-
private crc32Table;
|
17
|
-
}
|
package/types/Cache/Cache.d.ts
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
import { Adapter } from "./Adapter";
|
2
|
-
export declare class Cache {
|
3
|
-
private adapter;
|
4
|
-
static caseSensitive: boolean;
|
5
|
-
constructor(adapter: Adapter);
|
6
|
-
private constructKey;
|
7
|
-
static setCaseSensitivity(value: boolean): boolean;
|
8
|
-
load(key: string | string[], ttl?: number, hash?: string): Promise<any>;
|
9
|
-
save(key: string | string[], data: any, hash?: string): Promise<boolean | string | any[]>;
|
10
|
-
list(key: string | string[]): Promise<string[]>;
|
11
|
-
purge(key: string | string[], hash?: string): Promise<boolean>;
|
12
|
-
flush(): Promise<boolean>;
|
13
|
-
ping(): Promise<boolean>;
|
14
|
-
getSize(): Promise<number>;
|
15
|
-
delWithStart(keys: string | string[]): Promise<number>;
|
16
|
-
}
|
package/types/actions/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './nodes';
|
package/types/actions/nodes.d.ts
DELETED
package/types/client.d.ts
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
import { Models } from './models';
|
2
|
-
type Payload = {
|
3
|
-
[key: string]: any;
|
4
|
-
};
|
5
|
-
type UploadProgress = {
|
6
|
-
$id: string;
|
7
|
-
progress: number;
|
8
|
-
sizeUploaded: number;
|
9
|
-
chunksTotal: number;
|
10
|
-
chunksUploaded: number;
|
11
|
-
};
|
12
|
-
type Headers = {
|
13
|
-
[key: string]: string;
|
14
|
-
};
|
15
|
-
declare class AppcondaException extends Error {
|
16
|
-
code: number;
|
17
|
-
response: string;
|
18
|
-
type: string;
|
19
|
-
constructor(message: string, code?: number, type?: string, response?: string);
|
20
|
-
}
|
21
|
-
declare class Client {
|
22
|
-
static CHUNK_SIZE: number;
|
23
|
-
config: {
|
24
|
-
endpoint: string;
|
25
|
-
selfSigned: boolean;
|
26
|
-
project: string;
|
27
|
-
mode: string;
|
28
|
-
key: string;
|
29
|
-
jwt: string;
|
30
|
-
locale: string;
|
31
|
-
session: string;
|
32
|
-
forwardeduseragent: string;
|
33
|
-
};
|
34
|
-
headers: Headers;
|
35
|
-
/**
|
36
|
-
* Set Endpoint
|
37
|
-
*
|
38
|
-
* Your project endpoint
|
39
|
-
*
|
40
|
-
* @param {string} endpoint
|
41
|
-
*
|
42
|
-
* @returns {this}
|
43
|
-
*/
|
44
|
-
setEndpoint(endpoint: string): this;
|
45
|
-
/**
|
46
|
-
* Set self-signed
|
47
|
-
*
|
48
|
-
* @param {boolean} selfSigned
|
49
|
-
*
|
50
|
-
* @returns {this}
|
51
|
-
*/
|
52
|
-
setSelfSigned(selfSigned: boolean): this;
|
53
|
-
/**
|
54
|
-
* Add header
|
55
|
-
*
|
56
|
-
* @param {string} header
|
57
|
-
* @param {string} value
|
58
|
-
*
|
59
|
-
* @returns {this}
|
60
|
-
*/
|
61
|
-
addHeader(header: string, value: string): this;
|
62
|
-
/**
|
63
|
-
* Set Project
|
64
|
-
*
|
65
|
-
* Your project ID
|
66
|
-
*
|
67
|
-
* @param value string
|
68
|
-
*
|
69
|
-
* @return {this}
|
70
|
-
*/
|
71
|
-
setProject(value: string): this;
|
72
|
-
/**
|
73
|
-
* Set Mode
|
74
|
-
*
|
75
|
-
* @param value string
|
76
|
-
*
|
77
|
-
* @return {this}
|
78
|
-
*/
|
79
|
-
setMode(value: string): this;
|
80
|
-
/**
|
81
|
-
* Set Key
|
82
|
-
*
|
83
|
-
* Your secret API key
|
84
|
-
*
|
85
|
-
* @param value string
|
86
|
-
*
|
87
|
-
* @return {this}
|
88
|
-
*/
|
89
|
-
setKey(value: string): this;
|
90
|
-
/**
|
91
|
-
* Set JWT
|
92
|
-
*
|
93
|
-
* Your secret JSON Web Token
|
94
|
-
*
|
95
|
-
* @param value string
|
96
|
-
*
|
97
|
-
* @return {this}
|
98
|
-
*/
|
99
|
-
setJWT(value: string): this;
|
100
|
-
/**
|
101
|
-
* Set Locale
|
102
|
-
*
|
103
|
-
* @param value string
|
104
|
-
*
|
105
|
-
* @return {this}
|
106
|
-
*/
|
107
|
-
setLocale(value: string): this;
|
108
|
-
/**
|
109
|
-
* Set Session
|
110
|
-
*
|
111
|
-
* The user session to authenticate with
|
112
|
-
*
|
113
|
-
* @param value string
|
114
|
-
*
|
115
|
-
* @return {this}
|
116
|
-
*/
|
117
|
-
setSession(value: string): this;
|
118
|
-
/**
|
119
|
-
* Set ForwardedUserAgent
|
120
|
-
*
|
121
|
-
* The user agent string of the client that made the request
|
122
|
-
*
|
123
|
-
* @param value string
|
124
|
-
*
|
125
|
-
* @return {this}
|
126
|
-
*/
|
127
|
-
setForwardedUserAgent(value: string): this;
|
128
|
-
setFallbackCookies(value: string): this;
|
129
|
-
prepareRequest(method: string, url: URL, headers?: Headers, params?: Payload): {
|
130
|
-
uri: string;
|
131
|
-
options: RequestInit;
|
132
|
-
};
|
133
|
-
chunkedUpload(method: string, url: URL, headers: Headers, originalPayload: Payload, onProgress: (progress: UploadProgress) => void): Promise<any>;
|
134
|
-
redirect(method: string, url: URL, headers?: Headers, params?: Payload): Promise<string>;
|
135
|
-
call(method: string, url: URL, headers?: Headers, params?: Payload, responseType?: string): Promise<any>;
|
136
|
-
static flatten(data: Payload, prefix?: string): Payload;
|
137
|
-
}
|
138
|
-
export { Client, AppcondaException };
|
139
|
-
export { Query } from './query';
|
140
|
-
export type { Models, Payload, UploadProgress };
|
141
|
-
export type { QueryTypes, QueryTypesList } from './query';
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare function Cache(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare function CacheKey(): (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare function Invalidate(keys: string | string[]): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
@@ -1,13 +0,0 @@
|
|
1
|
-
export declare enum ApiService {
|
2
|
-
Account = "account",
|
3
|
-
Avatars = "avatars",
|
4
|
-
Databases = "databases",
|
5
|
-
Locale = "locale",
|
6
|
-
Health = "health",
|
7
|
-
Storage = "storage",
|
8
|
-
Teams = "teams",
|
9
|
-
Users = "users",
|
10
|
-
Functions = "functions",
|
11
|
-
Graphql = "graphql",
|
12
|
-
Messaging = "messaging"
|
13
|
-
}
|