seyfert 2.1.1-dev-12471001861.0 → 2.1.1-dev-12485652015.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.
@@ -16,8 +16,8 @@ export declare class MemoryAdapter<T> implements Adapter {
16
16
  get(keys: string): unknown;
17
17
  bulkSet(keys: [string, any][]): void;
18
18
  set(key: string, data: any): void;
19
- bulkPatch(updateOnly: boolean, keys: [string, any][]): void;
20
- patch(updateOnly: boolean, keys: string, data: any): void;
19
+ bulkPatch(keys: [string, any][]): void;
20
+ patch(keys: string, data: any): void;
21
21
  values(to: string): any[];
22
22
  keys(to: string): string[];
23
23
  count(to: string): number;
@@ -49,20 +49,14 @@ class MemoryAdapter {
49
49
  set(key, data) {
50
50
  this.storage.set(key, this.options.encode(data));
51
51
  }
52
- bulkPatch(updateOnly, keys) {
52
+ bulkPatch(keys) {
53
53
  for (const [key, value] of keys) {
54
54
  const oldData = this.get(key);
55
- if (updateOnly && !oldData) {
56
- continue;
57
- }
58
55
  this.storage.set(key, Array.isArray(value) ? this.options.encode(value) : this.options.encode({ ...(oldData ?? {}), ...value }));
59
56
  }
60
57
  }
61
- patch(updateOnly, keys, data) {
58
+ patch(keys, data) {
62
59
  const oldData = this.get(keys);
63
- if (updateOnly && !oldData) {
64
- return;
65
- }
66
60
  this.storage.set(keys, Array.isArray(data) ? this.options.encode(data) : this.options.encode({ ...(oldData ?? {}), ...data }));
67
61
  }
68
62
  values(to) {
@@ -37,8 +37,8 @@ export declare class LimitedMemoryAdapter<T> implements Adapter {
37
37
  private __set;
38
38
  bulkSet(keys: [string, any][]): void;
39
39
  set(keys: string, data: any): void;
40
- bulkPatch(updateOnly: boolean, keys: [string, any][]): void;
41
- patch(updateOnly: boolean, keys: string, data: any): void;
40
+ bulkPatch(keys: [string, any][]): void;
41
+ patch(keys: string, data: any): void;
42
42
  values(to: string): any[];
43
43
  keys(to: string): string[];
44
44
  count(to: string): number;
@@ -103,20 +103,14 @@ class LimitedMemoryAdapter {
103
103
  set(keys, data) {
104
104
  this.__set(keys, data);
105
105
  }
106
- bulkPatch(updateOnly, keys) {
106
+ bulkPatch(keys) {
107
107
  for (const [key, value] of keys) {
108
108
  const oldData = this.get(key);
109
- if (updateOnly && !oldData) {
110
- continue;
111
- }
112
109
  this.__set(key, Array.isArray(value) ? value : { ...(oldData ?? {}), ...value });
113
110
  }
114
111
  }
115
- patch(updateOnly, keys, data) {
112
+ patch(keys, data) {
116
113
  const oldData = this.get(keys);
117
- if (updateOnly && !oldData) {
118
- return;
119
- }
120
114
  this.__set(keys, Array.isArray(data) ? data : { ...(oldData ?? {}), ...data });
121
115
  }
122
116
  values(to) {
@@ -9,8 +9,8 @@ export interface Adapter {
9
9
  get(keys: string): Awaitable<any | null>;
10
10
  bulkSet(keyValue: [string, any][]): Awaitable<void>;
11
11
  set(id: string, data: any): Awaitable<void>;
12
- bulkPatch(updateOnly: boolean, keyValue: [string, any][]): Awaitable<void>;
13
- patch(updateOnly: boolean, id: string, data: any): Awaitable<void>;
12
+ bulkPatch(keyValue: [string, any][]): Awaitable<void>;
13
+ patch(id: string, data: any): Awaitable<void>;
14
14
  values(to: string): Awaitable<any[]>;
15
15
  keys(to: string): Awaitable<string[]>;
16
16
  count(to: string): Awaitable<number>;
@@ -238,7 +238,7 @@ class Cache {
238
238
  }
239
239
  }
240
240
  await this.adapter.bulkAddToRelationShip(relationshipsData);
241
- await this.adapter.bulkPatch(false, allData);
241
+ await this.adapter.bulkPatch(allData);
242
242
  }
243
243
  async bulkSet(keys) {
244
244
  const allData = [];
@@ -42,7 +42,7 @@ class BaseResource {
42
42
  patch(id, data) {
43
43
  if (!this.filter(data, id))
44
44
  return;
45
- return (0, common_1.fakePromise)(this.addToRelationship(id)).then(() => this.adapter.patch(false, this.hashId(id), data));
45
+ return (0, common_1.fakePromise)(this.addToRelationship(id)).then(() => this.adapter.patch(this.hashId(id), data));
46
46
  }
47
47
  remove(id) {
48
48
  return (0, common_1.fakePromise)(this.removeToRelationship(id)).then(() => this.adapter.remove(this.hashId(id)));
@@ -19,8 +19,8 @@ export declare class GuildRelatedResource<T = any, S = any> {
19
19
  })[]>;
20
20
  set(__keys: string, guild: string, data: S): ReturnCache<void>;
21
21
  set(__keys: [string, S][], guild: string): ReturnCache<void>;
22
- patch(__keys: string, guild?: string, data?: any): ReturnCache<void>;
23
- patch(__keys: [string, any][], guild?: string): ReturnCache<void>;
22
+ patch(__keys: string, guild: string, data?: any): ReturnCache<void>;
23
+ patch(__keys: [string, any][], guild: string): ReturnCache<void>;
24
24
  remove(id: string | string[], guild: string): import("../../../common").Awaitable<void>;
25
25
  keys(guild: string): ReturnCache<string[]>;
26
26
  values(guild: string): ReturnCache<(T & {
@@ -47,14 +47,9 @@ class GuildRelatedResource {
47
47
  }
48
48
  patch(__keys, guild, data) {
49
49
  const keys = (Array.isArray(__keys) ? __keys : [[__keys, data]]).filter(x => this.filter(x[1], x[0], guild));
50
- if (guild) {
51
- return (0, common_1.fakePromise)(this.addToRelationship(keys.map(x => x[0]), guild)).then(() => this.adapter.bulkPatch(false, keys.map(([key, value]) => {
52
- return [this.hashId(key), this.parse(value, key, guild)];
53
- })));
54
- }
55
- return (0, common_1.fakePromise)(this.adapter.bulkPatch(true, keys.map(([key, value]) => {
56
- return [this.hashId(key), value];
57
- }))).then(x => x);
50
+ return (0, common_1.fakePromise)(this.addToRelationship(keys.map(x => x[0]), guild)).then(() => this.adapter.bulkPatch(keys.map(([key, value]) => {
51
+ return [this.hashId(key), this.parse(value, key, guild)];
52
+ })));
58
53
  }
59
54
  remove(id, guild) {
60
55
  const ids = Array.isArray(id) ? id : [id];
@@ -29,7 +29,7 @@ class ChannelShorter extends base_1.BaseShorter {
29
29
  }
30
30
  }
31
31
  channel = await this.client.proxy.channels(id).get();
32
- await this.client.cache.channels?.patch(id, undefined, channel);
32
+ await this.client.cache.channels?.patch(id, 'guild_id' in channel && channel.guild_id ? channel.guild_id : '@me', channel);
33
33
  return channel;
34
34
  }
35
35
  /**
@@ -1,4 +1,4 @@
1
- import type { ClientUserStructure } from '../client';
1
+ import { type ClientUserStructure } from '../client';
2
2
  import type { UsingClient } from '../commands';
3
3
  import type { GatewayReadyDispatchData, RESTPatchAPICurrentUserJSONBody } from '../types';
4
4
  import { User } from './User';
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ClientUser = void 0;
4
+ const client_1 = require("../client");
4
5
  const User_1 = require("./User");
5
6
  class ClientUser extends User_1.User {
6
7
  application;
@@ -11,11 +12,11 @@ class ClientUser extends User_1.User {
11
12
  }
12
13
  async fetch() {
13
14
  const data = await this.api.users('@me').get();
14
- return new ClientUser(this.client, data, this.application);
15
+ return client_1.Transformers.ClientUser(this.client, data, this.application);
15
16
  }
16
17
  async edit(body) {
17
18
  const data = await this.api.users('@me').patch({ body });
18
- return new ClientUser(this.client, data, this.application);
19
+ return client_1.Transformers.ClientUser(this.client, data, this.application);
19
20
  }
20
21
  }
21
22
  exports.ClientUser = ClientUser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seyfert",
3
- "version": "2.1.1-dev-12471001861.0",
3
+ "version": "2.1.1-dev-12485652015.0",
4
4
  "description": "The most advanced framework for discord bots",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",