@koralabs/kora-labs-common 6.2.1 → 6.3.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.
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
import { IPersonalizedHandle, ISubHandleSettings, IUTxO } from '.';
|
|
1
|
+
import { HandleType, IPersonalizedHandle, ISubHandleSettings, IUTxO, Rarity } from '.';
|
|
2
2
|
import { IMarketplaceListing } from '../../marketplace/interfaces';
|
|
3
3
|
import { Sort } from '../../types';
|
|
4
4
|
export interface IApiStore {
|
|
5
5
|
initialize: () => Promise<IApiStore>;
|
|
6
6
|
destroy: () => void;
|
|
7
7
|
rollBackToGenesis: () => void;
|
|
8
|
+
pipeline: (commands: CallableFunction) => ApiIndexType | ApiIndexType[] | void;
|
|
8
9
|
getStartingPoint: (save: (handle: StoredHandle) => void, failed: boolean) => Promise<{
|
|
9
10
|
slot: number;
|
|
10
11
|
id: string;
|
|
11
12
|
} | null>;
|
|
12
|
-
getIndex: (index: IndexNames
|
|
13
|
-
|
|
13
|
+
getIndex: (index: IndexNames, limit?: {
|
|
14
|
+
offset: number;
|
|
15
|
+
count: number;
|
|
16
|
+
}, sort?: Sort) => Map<string | number, ApiIndexType>;
|
|
17
|
+
getKeysFromIndex: (index: IndexNames, limit?: {
|
|
18
|
+
offset: number;
|
|
19
|
+
count: number;
|
|
20
|
+
}, sort?: Sort) => (string | number)[];
|
|
14
21
|
getValueFromIndex: (index: IndexNames, key: string | number) => ApiIndexType | undefined;
|
|
15
22
|
setValueOnIndex: (index: IndexNames, key: string | number, value: ApiIndexType) => void;
|
|
16
23
|
removeKeyFromIndex: (index: IndexNames, key: string | number) => void;
|
|
17
|
-
getValuesFromIndexedSet: (index: IndexNames, key: string | number
|
|
24
|
+
getValuesFromIndexedSet: (index: IndexNames, key: string | number, limit?: {
|
|
25
|
+
offset: number;
|
|
26
|
+
count: number;
|
|
27
|
+
}, sort?: Sort) => Set<string> | undefined;
|
|
18
28
|
addValueToIndexedSet: (index: IndexNames, key: string | number, value: string) => void;
|
|
19
29
|
removeValueFromIndexedSet: (index: IndexNames, key: string | number, value: string) => void;
|
|
20
30
|
getMetrics: () => IApiMetrics;
|
|
@@ -92,14 +102,14 @@ export interface HolderViewModel {
|
|
|
92
102
|
manually_set: boolean;
|
|
93
103
|
}
|
|
94
104
|
export interface IHandleSearchParams {
|
|
95
|
-
characters?:
|
|
105
|
+
characters?: CharacterAttribute;
|
|
96
106
|
length?: string;
|
|
97
|
-
rarity?:
|
|
98
|
-
numeric_modifiers?:
|
|
107
|
+
rarity?: Rarity;
|
|
108
|
+
numeric_modifiers?: NumericModifiersAttribute;
|
|
99
109
|
search?: string;
|
|
100
110
|
holder_address?: string;
|
|
101
111
|
personalized?: boolean;
|
|
102
|
-
handle_type?:
|
|
112
|
+
handle_type?: HandleType;
|
|
103
113
|
public_subhandles?: boolean;
|
|
104
114
|
og?: 'true' | 'false';
|
|
105
115
|
}
|
|
@@ -140,7 +150,12 @@ export declare enum IndexNames {
|
|
|
140
150
|
NUMERIC_MODIFIER = "numericmodifiers",
|
|
141
151
|
OG = "og",
|
|
142
152
|
PAYMENT_KEY_HASH = "paymentkeyhashes",
|
|
153
|
+
PERSONALIZED = "personalized",
|
|
143
154
|
RARITY = "rarity",
|
|
155
|
+
SLOT = "slot",
|
|
144
156
|
SLOT_HISTORY = "slothistory",
|
|
145
|
-
SUBHANDLE = "subhandle"
|
|
157
|
+
SUBHANDLE = "subhandle",
|
|
158
|
+
HANDLE_TYPE = "handle_type"
|
|
146
159
|
}
|
|
160
|
+
export type CharacterAttribute = 'letters' | 'numbers' | 'special' | 'letters,numbers' | 'numbers,special' | 'letters,special' | 'letters,numbers,special';
|
|
161
|
+
export type NumericModifiersAttribute = 'negative' | 'decimal' | 'negative,decimal' | '';
|
|
@@ -13,7 +13,10 @@ var IndexNames;
|
|
|
13
13
|
IndexNames["NUMERIC_MODIFIER"] = "numericmodifiers";
|
|
14
14
|
IndexNames["OG"] = "og";
|
|
15
15
|
IndexNames["PAYMENT_KEY_HASH"] = "paymentkeyhashes";
|
|
16
|
+
IndexNames["PERSONALIZED"] = "personalized";
|
|
16
17
|
IndexNames["RARITY"] = "rarity";
|
|
18
|
+
IndexNames["SLOT"] = "slot";
|
|
17
19
|
IndexNames["SLOT_HISTORY"] = "slothistory";
|
|
18
20
|
IndexNames["SUBHANDLE"] = "subhandle";
|
|
21
|
+
IndexNames["HANDLE_TYPE"] = "handle_type";
|
|
19
22
|
})(IndexNames = exports.IndexNames || (exports.IndexNames = {}));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { IHandleSearchInput } from '..';
|
|
1
|
+
import { CharacterAttribute, HandleType, IHandleSearchInput, NumericModifiersAttribute, Rarity } from '..';
|
|
2
2
|
export declare class HandleSearchModel implements IHandleSearchInput {
|
|
3
|
-
characters?:
|
|
3
|
+
characters?: CharacterAttribute;
|
|
4
4
|
length?: string;
|
|
5
|
-
rarity?:
|
|
6
|
-
numeric_modifiers?:
|
|
5
|
+
rarity?: Rarity;
|
|
6
|
+
numeric_modifiers?: NumericModifiersAttribute;
|
|
7
7
|
search?: string;
|
|
8
8
|
holder_address?: string;
|
|
9
9
|
personalized?: boolean;
|
|
10
|
-
handle_type?:
|
|
10
|
+
handle_type?: HandleType;
|
|
11
11
|
og?: 'true' | 'false';
|
|
12
12
|
handles?: string[];
|
|
13
13
|
constructor(input?: IHandleSearchInput);
|
package/package.json
CHANGED
package/utils/index.js
CHANGED
|
@@ -94,7 +94,7 @@ const getElapsedTime = (milliseconds) => {
|
|
|
94
94
|
return `${mins}:${(seconds - mins * 60).toString().padStart(2, '0')}`;
|
|
95
95
|
};
|
|
96
96
|
exports.getElapsedTime = getElapsedTime;
|
|
97
|
-
const objectHasKeys = (o) => Object.keys(o).length
|
|
97
|
+
const objectHasKeys = (o) => Object.keys(o).length > 0;
|
|
98
98
|
exports.objectHasKeys = objectHasKeys;
|
|
99
99
|
const isEmpty = (obj) => [Object, Array].includes((obj || {}).constructor) && !Object.entries(obj || {}).length;
|
|
100
100
|
exports.isEmpty = isEmpty;
|
|
@@ -104,7 +104,7 @@ const hasOwnProperty = (o, ...args) => Object.prototype.hasOwnProperty.call(o, .
|
|
|
104
104
|
exports.hasOwnProperty = hasOwnProperty;
|
|
105
105
|
const isDate = (d) => d instanceof Date;
|
|
106
106
|
exports.isDate = isDate;
|
|
107
|
-
const isEmptyObject = (o) => (0, exports.isObject)(o) && (0, exports.objectHasKeys)(o);
|
|
107
|
+
const isEmptyObject = (o) => (0, exports.isObject)(o) && (!(0, exports.objectHasKeys)(o) || Object.values(o).every(v => v == null || v == undefined));
|
|
108
108
|
exports.isEmptyObject = isEmptyObject;
|
|
109
109
|
const makeObjectWithoutPrototype = () => Object.create(null);
|
|
110
110
|
exports.makeObjectWithoutPrototype = makeObjectWithoutPrototype;
|