@arkiv-network/sdk 0.7.0-dev.1 → 0.8.0-advanced.2
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/README.md +71 -16
- package/dist/actions/advanced/index.cjs +13 -0
- package/dist/actions/advanced/index.d.cts +8 -0
- package/dist/actions/advanced/index.d.ts +9 -0
- package/dist/actions/advanced/index.js +9 -0
- package/dist/advanced-8ZPTmmaN.js +598 -0
- package/dist/advanced-8ZPTmmaN.js.map +1 -0
- package/dist/advanced-fPImL6lW.cjs +656 -0
- package/dist/arkivTransactions-D74gERHG.d.cts +571 -0
- package/dist/arkivTransactions-D74gERHG.d.cts.map +1 -0
- package/dist/arkivTransactions-NtGD6uk5.d.ts +571 -0
- package/dist/arkivTransactions-NtGD6uk5.d.ts.map +1 -0
- package/dist/attr/index.cjs +35 -0
- package/dist/attr/index.d.cts +2 -0
- package/dist/attr/index.d.ts +3 -0
- package/dist/attr/index.js +4 -0
- package/dist/attributes-BhY5DwJp.js +809 -0
- package/dist/attributes-BhY5DwJp.js.map +1 -0
- package/dist/attributes-Df9IsCVs.cjs +1029 -0
- package/dist/chains/index.cjs +2 -3
- package/dist/chains/index.d.cts +22 -60
- package/dist/chains/index.d.cts.map +1 -1
- package/dist/chains/index.d.ts +22 -60
- package/dist/chains/index.d.ts.map +1 -1
- package/dist/chains/index.js +2 -2
- package/dist/chains-BJrZs6sG.js +57 -0
- package/dist/chains-BJrZs6sG.js.map +1 -0
- package/dist/chains-BYRTTipa.cjs +73 -0
- package/dist/codec-Car3KkFF.d.ts +102 -0
- package/dist/codec-Car3KkFF.d.ts.map +1 -0
- package/dist/entity/index.cjs +20 -0
- package/dist/entity/index.d.cts +4 -0
- package/dist/entity/index.d.ts +5 -0
- package/dist/entity/index.js +7 -0
- package/dist/entity-B00Li04j.cjs +71 -0
- package/dist/entity-B7G8q_Eo.cjs +0 -0
- package/dist/entity-BYQR1uoe.js +67 -0
- package/dist/entity-BYQR1uoe.js.map +1 -0
- package/dist/entity-CD_qFF2M.js +0 -0
- package/dist/errors-BVbjKVMN.cjs +56 -0
- package/dist/errors-LTe7bOYS.js +33 -0
- package/dist/errors-LTe7bOYS.js.map +1 -0
- package/dist/expiry-BELY2Kpw.cjs +135 -0
- package/dist/expiry-BjpxZZQU.js +95 -0
- package/dist/expiry-BjpxZZQU.js.map +1 -0
- package/dist/expiry-DRV29F1r.d.cts +79 -0
- package/dist/expiry-DRV29F1r.d.cts.map +1 -0
- package/dist/expiry-nDbCgZX4.d.ts +79 -0
- package/dist/expiry-nDbCgZX4.d.ts.map +1 -0
- package/dist/flags-5dTNRnow.d.ts +41 -0
- package/dist/flags-5dTNRnow.d.ts.map +1 -0
- package/dist/flags-CRjPpoh3.d.cts +41 -0
- package/dist/flags-CRjPpoh3.d.cts.map +1 -0
- package/dist/flags-DFBs2J94.js +33 -0
- package/dist/flags-DFBs2J94.js.map +1 -0
- package/dist/flags-kr276q6i.cjs +43 -0
- package/dist/index-B5j76711.d.ts +184 -0
- package/dist/index-B5j76711.d.ts.map +1 -0
- package/dist/index-BF7Mq9Is.d.cts +280 -0
- package/dist/index-BF7Mq9Is.d.cts.map +1 -0
- package/dist/index-CA4V7Pdh.d.cts +167 -0
- package/dist/index-CA4V7Pdh.d.cts.map +1 -0
- package/dist/index-CV5zCdpa.d.cts +417 -0
- package/dist/index-CV5zCdpa.d.cts.map +1 -0
- package/dist/index-DHDud2hC.d.ts +280 -0
- package/dist/index-DHDud2hC.d.ts.map +1 -0
- package/dist/index-DvYvrkdk.d.ts +320 -0
- package/dist/index-DvYvrkdk.d.ts.map +1 -0
- package/dist/index-EeUO0nnJ.d.cts +184 -0
- package/dist/index-EeUO0nnJ.d.cts.map +1 -0
- package/dist/index-fX_XyqLp.d.ts +167 -0
- package/dist/index-fX_XyqLp.d.ts.map +1 -0
- package/dist/index.cjs +411 -405
- package/dist/index.d.cts +360 -209
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +361 -209
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +342 -387
- package/dist/index.js.map +1 -1
- package/dist/key-D1Bh7MF0.js +70 -0
- package/dist/key-D1Bh7MF0.js.map +1 -0
- package/dist/key-WKhXnXuU.cjs +98 -0
- package/dist/logger-CVpvU8ik.js +153 -0
- package/dist/logger-CVpvU8ik.js.map +1 -0
- package/dist/logger-Cr15lPAQ.cjs +188 -0
- package/dist/payload-BNoud2KZ.d.cts +94 -0
- package/dist/payload-BNoud2KZ.d.cts.map +1 -0
- package/dist/payload-Bz6651ax.js +67 -0
- package/dist/payload-Bz6651ax.js.map +1 -0
- package/dist/payload-CcUj85ys.d.ts +94 -0
- package/dist/payload-CcUj85ys.d.ts.map +1 -0
- package/dist/payload-KC14SDlN.cjs +83 -0
- package/dist/query/index.cjs +26 -150
- package/dist/query/index.d.cts +5 -3
- package/dist/query/index.d.ts +6 -3
- package/dist/query/index.js +8 -138
- package/dist/queryBuilder-DM6AWCBa.js +820 -0
- package/dist/queryBuilder-DM6AWCBa.js.map +1 -0
- package/dist/queryBuilder-DbUMEZln.cjs +944 -0
- package/dist/selection-C4UhsMOO.d.ts +434 -0
- package/dist/selection-C4UhsMOO.d.ts.map +1 -0
- package/dist/selection-DPg0uyJf.d.cts +433 -0
- package/dist/selection-DPg0uyJf.d.cts.map +1 -0
- package/dist/types/index.cjs +3 -3
- package/dist/types/index.d.cts +7 -2
- package/dist/types/index.d.ts +8 -2
- package/dist/types/index.js +3 -3
- package/dist/types-Bu_ZwMbZ.js +0 -0
- package/dist/types-NRqymi6S.cjs +0 -0
- package/dist/utils/index.cjs +4 -17
- package/dist/utils/index.d.cts +3 -17
- package/dist/utils/index.d.ts +3 -17
- package/dist/utils/index.js +4 -18
- package/package.json +26 -5
- package/src/actions/advanced/advanced.test.ts +258 -0
- package/src/actions/advanced/buildMutation.ts +104 -0
- package/src/actions/advanced/getMutationResult.ts +112 -0
- package/src/actions/advanced/index.ts +21 -0
- package/src/actions/advanced/pingTransaction.ts +43 -0
- package/src/actions/advanced/sendMutation.ts +59 -0
- package/src/actions/public/getEntity.ts +27 -43
- package/src/actions/public/getEntityNonce.ts +30 -0
- package/src/actions/public/predictEntityKeys.test.ts +143 -0
- package/src/actions/public/predictEntityKeys.ts +138 -0
- package/src/actions/public/query.ts +35 -67
- package/src/actions/public/watchEntityEvents.test.ts +414 -0
- package/src/actions/public/watchEntityEvents.ts +225 -0
- package/src/actions/wallet/changeOwnership.ts +2 -2
- package/src/actions/wallet/createEntity.ts +99 -24
- package/src/actions/wallet/extendEntity.ts +37 -13
- package/src/actions/wallet/mutateEntities.test.ts +76 -0
- package/src/actions/wallet/mutateEntities.ts +16 -33
- package/src/actions/wallet/patchEntity.ts +90 -0
- package/src/attr/attributes.test.ts +120 -0
- package/src/attr/attributes.ts +190 -0
- package/src/attr/codec.test.ts +162 -0
- package/src/attr/codec.ts +220 -0
- package/src/attr/decimal.ts +86 -0
- package/src/attr/errors.ts +145 -0
- package/src/attr/index.ts +50 -0
- package/src/attr/names.ts +106 -0
- package/src/attr/types.ts +150 -0
- package/src/attr/values.test.ts +271 -0
- package/src/attr/values.ts +502 -0
- package/src/chains/cheesecake.ts +22 -0
- package/src/chains/index.ts +1 -2
- package/src/clients/createPublicClient.test.ts +3 -5
- package/src/clients/createPublicClient.ts +5 -4
- package/src/clients/createWalletClient.test.ts +2 -2
- package/src/clients/createWalletClient.ts +13 -7
- package/src/clients/decorators/arkivAdvanced.ts +144 -0
- package/src/clients/decorators/arkivPublic.ts +172 -139
- package/src/clients/decorators/arkivWallet.ts +101 -94
- package/src/entity/create.test.ts +184 -0
- package/src/entity/errors.ts +38 -0
- package/src/entity/events.ts +16 -0
- package/src/entity/expiry.test.ts +195 -0
- package/src/entity/expiry.ts +181 -0
- package/src/entity/flags.ts +65 -0
- package/src/entity/index.ts +15 -0
- package/src/entity/key.ts +68 -0
- package/src/entity/operations.ts +134 -0
- package/src/entity/params.ts +15 -0
- package/src/errors.ts +26 -49
- package/src/index.ts +19 -0
- package/src/query/engine.ts +68 -137
- package/src/query/errors.ts +151 -0
- package/src/query/expression.test.ts +286 -0
- package/src/query/expression.ts +493 -0
- package/src/query/index.ts +40 -4
- package/src/query/injection.test.ts +151 -0
- package/src/query/queryBuilder.test.ts +342 -637
- package/src/query/queryBuilder.ts +133 -359
- package/src/query/queryResult.ts +54 -51
- package/src/query/selection.test.ts +48 -98
- package/src/query/selection.ts +77 -65
- package/src/types/entity.test.ts +44 -155
- package/src/types/entity.ts +60 -52
- package/src/types/events.ts +59 -16
- package/src/types/index.ts +20 -17
- package/src/types/rpcSchema.ts +69 -37
- package/src/utils/arkivTransactions.test.ts +600 -155
- package/src/utils/arkivTransactions.ts +350 -219
- package/src/utils/chains.test.ts +21 -24
- package/src/utils/compression.ts +1 -1
- package/src/utils/entities.test.ts +62 -0
- package/src/utils/entities.ts +109 -37
- package/src/utils/expirationTime.ts +114 -10
- package/src/utils/logger.ts +2 -2
- package/src/utils/revert.test.ts +99 -0
- package/src/utils/revert.ts +145 -0
- package/dist/chains-BifaY04V.cjs +0 -108
- package/dist/chains-CrtkVbBh.js +0 -86
- package/dist/chains-CrtkVbBh.js.map +0 -1
- package/dist/consts-Bz0LZQZY.js +0 -7
- package/dist/consts-Bz0LZQZY.js.map +0 -1
- package/dist/consts-CxT1-RXU.cjs +0 -18
- package/dist/entity-BhSXaB23.cjs +0 -81
- package/dist/entity-CN41IOrq.d.cts +0 -401
- package/dist/entity-CN41IOrq.d.cts.map +0 -1
- package/dist/entity-DGfVyB-a.js +0 -71
- package/dist/entity-DGfVyB-a.js.map +0 -1
- package/dist/entity-NnEVlePN.d.ts +0 -401
- package/dist/entity-NnEVlePN.d.ts.map +0 -1
- package/dist/index-ClkpS6s_.d.ts +0 -481
- package/dist/index-ClkpS6s_.d.ts.map +0 -1
- package/dist/index-w4qop0Pe.d.cts +0 -481
- package/dist/index-w4qop0Pe.d.cts.map +0 -1
- package/dist/payload-BpNUPOnY.js +0 -13
- package/dist/payload-BpNUPOnY.js.map +0 -1
- package/dist/payload-C2KHOUoj.d.ts +0 -6
- package/dist/payload-C2KHOUoj.d.ts.map +0 -1
- package/dist/payload-CJN8fTvX.d.cts +0 -6
- package/dist/payload-CJN8fTvX.d.cts.map +0 -1
- package/dist/payload-D8YLKcJj.cjs +0 -23
- package/dist/query/index.js.map +0 -1
- package/dist/queryBuilder-BE_XhLLa.js +0 -735
- package/dist/queryBuilder-BE_XhLLa.js.map +0 -1
- package/dist/queryBuilder-J37buGCi.cjs +0 -865
- package/dist/utils/index.d.cts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/src/actions/public/buildQuery.ts +0 -10
- package/src/actions/public/subscribeEntityEvents.ts +0 -93
- package/src/actions/wallet/updateEntity.ts +0 -59
- package/src/chains/braga.ts +0 -26
- package/src/chains/kaolin.ts +0 -29
- package/src/query/engine.test.ts +0 -571
- package/src/query/predicate.test.ts +0 -461
- package/src/query/predicate.ts +0 -144
- package/src/query/queryResult.test.ts +0 -270
- package/src/query/selectQueryBuilder.test.ts +0 -213
- package/src/types/attributes.ts +0 -28
- package/src/utils/validation.test.ts +0 -106
- package/src/utils/validation.ts +0 -80
- /package/dist/{types-Ci4BRClw.js → attr-DlmErkvR.cjs} +0 -0
- /package/dist/{types-a8gm_IaQ.cjs → attr-GcQKatub.js} +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const require_expiry = require('./expiry-BELY2Kpw.cjs');
|
|
2
|
+
const require_errors = require('./errors-BVbjKVMN.cjs');
|
|
3
|
+
let viem = require("viem");
|
|
4
|
+
|
|
5
|
+
//#region src/utils/expirationTime.ts
|
|
6
|
+
function lifetimeOf(seconds) {
|
|
7
|
+
return require_expiry.makeExpiry(require_expiry.toBlocks(seconds), 0n);
|
|
8
|
+
}
|
|
9
|
+
function deadlineOf(expiresAt, options) {
|
|
10
|
+
return require_expiry.makeExpiry(options?.atLeast?.minLifetime ?? 0n, expiresAt);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Builds the `expires` of a create or an extension.
|
|
14
|
+
*
|
|
15
|
+
* Every helper returns the `{ minLifetime, expiresAt }` pair the ABI carries, so what you write is
|
|
16
|
+
* what goes on the wire. The `from*` helpers fill `minLifetime` and leave `expiresAt` at `0n`;
|
|
17
|
+
* {@link ExpirationTime.atBlock} and {@link ExpirationTime.atDate} do the reverse. The engine takes
|
|
18
|
+
* whichever comes later, which is why a deadline can also carry a floor.
|
|
19
|
+
*
|
|
20
|
+
* Values are plain data — no methods, no prototype — so they log, clone and compare like any other
|
|
21
|
+
* object.
|
|
22
|
+
*
|
|
23
|
+
* @example The 90% case: a duration, and nothing else to think about.
|
|
24
|
+
* await client.createEntity({ payload, contentType, expires: ExpirationTime.fromDays(30) })
|
|
25
|
+
*
|
|
26
|
+
* @example An exact block, or a wall-clock date.
|
|
27
|
+
* expires: ExpirationTime.atBlock(1_200_000n)
|
|
28
|
+
* expires: ExpirationTime.atDate(new Date("2027-01-01"))
|
|
29
|
+
*
|
|
30
|
+
* @example A deadline that still guarantees a minimum life.
|
|
31
|
+
* expires: ExpirationTime.atBlock(1_200_000n, { atLeast: ExpirationTime.fromDays(1) })
|
|
32
|
+
*/
|
|
33
|
+
const ExpirationTime = {
|
|
34
|
+
fromSeconds: (seconds) => lifetimeOf(seconds),
|
|
35
|
+
fromMinutes: (minutes) => lifetimeOf(minutes * 60),
|
|
36
|
+
fromHours: (hours) => lifetimeOf(hours * 60 * 60),
|
|
37
|
+
fromDays: (days) => lifetimeOf(days * 24 * 60 * 60),
|
|
38
|
+
fromWeeks: (weeks) => lifetimeOf(weeks * 7 * 24 * 60 * 60),
|
|
39
|
+
fromMonths: (months) => lifetimeOf(months * 30 * 24 * 60 * 60),
|
|
40
|
+
fromYears: (years) => lifetimeOf(years * 365 * 24 * 60 * 60),
|
|
41
|
+
fromBlocks: (blocks) => {
|
|
42
|
+
if (!Number.isInteger(blocks) || blocks <= 0) throw new require_errors.InvalidExpiryError(`a lifetime must be a positive whole number of blocks, got ${blocks}`);
|
|
43
|
+
return require_expiry.makeExpiry(BigInt(blocks), 0n);
|
|
44
|
+
},
|
|
45
|
+
atBlock: (block, options) => {
|
|
46
|
+
if (typeof block !== "bigint" || block < 0n) throw new require_errors.InvalidExpiryError(`a deadline must be a non-negative block height, got ${block}`);
|
|
47
|
+
return deadlineOf(block, options);
|
|
48
|
+
},
|
|
49
|
+
atDate: (date, options) => {
|
|
50
|
+
if (!(date instanceof Date) || Number.isNaN(date.getTime())) throw new require_errors.InvalidExpiryError(`a deadline must be a valid Date, got ${String(date)}`);
|
|
51
|
+
return deadlineOf(date, options);
|
|
52
|
+
},
|
|
53
|
+
permanent: () => deadlineOf(require_expiry.MAX_EXPIRES_AT)
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/utils/payload.ts
|
|
58
|
+
function jsonToPayload(json) {
|
|
59
|
+
return (0, viem.toBytes)(JSON.stringify(json));
|
|
60
|
+
}
|
|
61
|
+
function stringToPayload(data) {
|
|
62
|
+
return (0, viem.stringToBytes)(data);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
Object.defineProperty(exports, 'ExpirationTime', {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return ExpirationTime;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, 'jsonToPayload', {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return jsonToPayload;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, 'stringToPayload', {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return stringToPayload;
|
|
82
|
+
}
|
|
83
|
+
});
|
package/dist/query/index.cjs
CHANGED
|
@@ -1,153 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
require('../
|
|
3
|
-
require('../
|
|
1
|
+
require('../attributes-Df9IsCVs.cjs');
|
|
2
|
+
require('../errors-BVbjKVMN.cjs');
|
|
3
|
+
require('../flags-kr276q6i.cjs');
|
|
4
|
+
require('../logger-Cr15lPAQ.cjs');
|
|
5
|
+
require('../attr-DlmErkvR.cjs');
|
|
6
|
+
require('../entity-B00Li04j.cjs');
|
|
7
|
+
const require_queryBuilder = require('../queryBuilder-DbUMEZln.cjs');
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type: "or",
|
|
9
|
-
predicates: predicates.flat()
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
function and(...predicates) {
|
|
13
|
-
return {
|
|
14
|
-
type: "and",
|
|
15
|
-
predicates: predicates.flat()
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Creates an equality predicate
|
|
20
|
-
* @param key - The key to compare
|
|
21
|
-
* @param value - The value to compare
|
|
22
|
-
* @returns The equality predicate
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* const predicate = eq("name", "John")
|
|
26
|
-
* // result = { type: "eq", key: "name", value: "John" }
|
|
27
|
-
*/
|
|
28
|
-
function eq(key, value) {
|
|
29
|
-
return {
|
|
30
|
-
type: "eq",
|
|
31
|
-
key,
|
|
32
|
-
value
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Creates a not equal predicate
|
|
37
|
-
* @param key - The key to compare
|
|
38
|
-
* @param value - The value to compare
|
|
39
|
-
* @returns The not equal predicate
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* const predicate = neq("name", "John")
|
|
43
|
-
* // result = { type: "neq", key: "name", value: "John" }
|
|
44
|
-
*/
|
|
45
|
-
function neq(key, value) {
|
|
46
|
-
return {
|
|
47
|
-
type: "neq",
|
|
48
|
-
key,
|
|
49
|
-
value
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Creates a greater than predicate
|
|
54
|
-
* @param key - The key to compare
|
|
55
|
-
* @param value - The value to compare
|
|
56
|
-
* @returns The greater than predicate
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* const predicate = gt("name", "John")
|
|
60
|
-
* // result = { type: "gt", key: "name", value: "John" }
|
|
61
|
-
*/
|
|
62
|
-
function gt(key, value) {
|
|
63
|
-
return {
|
|
64
|
-
type: "gt",
|
|
65
|
-
key,
|
|
66
|
-
value
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Creates a greater than or equal predicate
|
|
71
|
-
* @param key - The key to compare
|
|
72
|
-
* @param value - The value to compare
|
|
73
|
-
* @returns The greater than or equal predicate
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* const predicate = gte("name", "John")
|
|
77
|
-
* // result = { type: "gte", key: "name", value: "John" }
|
|
78
|
-
*/
|
|
79
|
-
function gte(key, value) {
|
|
80
|
-
return {
|
|
81
|
-
type: "gte",
|
|
82
|
-
key,
|
|
83
|
-
value
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Creates a less than predicate
|
|
88
|
-
* @param key - The key to compare
|
|
89
|
-
* @param value - The value to compare
|
|
90
|
-
* @returns The less than predicate
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* const predicate = lt("name", "John")
|
|
94
|
-
* // result = { type: "lt", key: "name", value: "John" }
|
|
95
|
-
*/
|
|
96
|
-
function lt(key, value) {
|
|
97
|
-
return {
|
|
98
|
-
type: "lt",
|
|
99
|
-
key,
|
|
100
|
-
value
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Creates a less than or equal predicate
|
|
105
|
-
* @param key - The key to compare
|
|
106
|
-
* @param value - The value to compare
|
|
107
|
-
* @returns The less than or equal predicate
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* const predicate = lte("name", "John")
|
|
111
|
-
* // result = { type: "lte", key: "name", value: "John" }
|
|
112
|
-
*/
|
|
113
|
-
function lte(key, value) {
|
|
114
|
-
return {
|
|
115
|
-
type: "lte",
|
|
116
|
-
key,
|
|
117
|
-
value
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Creates a not predicate
|
|
122
|
-
* @param key - The key to compare
|
|
123
|
-
* @returns The not predicate
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* const predicate = not("name")
|
|
127
|
-
* // result = { type: "not", key: "name", value: "" }
|
|
128
|
-
*/
|
|
129
|
-
function not(key) {
|
|
130
|
-
return {
|
|
131
|
-
type: "not",
|
|
132
|
-
key,
|
|
133
|
-
value: ""
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
//#endregion
|
|
138
|
-
exports.BaseQueryBuilder = require_queryBuilder.BaseQueryBuilder;
|
|
139
|
-
exports.QueryBuilder = require_queryBuilder.QueryBuilder;
|
|
9
|
+
exports.InvalidPredicateError = require_queryBuilder.InvalidPredicateError;
|
|
10
|
+
exports.MAX_LIMIT = require_queryBuilder.MAX_LIMIT;
|
|
11
|
+
exports.QueryError = require_queryBuilder.QueryError;
|
|
140
12
|
exports.QueryResult = require_queryBuilder.QueryResult;
|
|
141
13
|
exports.SelectQueryBuilder = require_queryBuilder.SelectQueryBuilder;
|
|
142
|
-
exports.
|
|
143
|
-
exports.
|
|
144
|
-
exports.
|
|
145
|
-
exports.
|
|
146
|
-
exports.gt = gt;
|
|
147
|
-
exports.gte = gte;
|
|
148
|
-
exports.
|
|
149
|
-
exports.
|
|
150
|
-
exports.
|
|
151
|
-
exports.
|
|
152
|
-
exports.
|
|
153
|
-
exports.
|
|
14
|
+
exports.UnsupportedOperatorError = require_queryBuilder.UnsupportedOperatorError;
|
|
15
|
+
exports.and = require_queryBuilder.and;
|
|
16
|
+
exports.eq = require_queryBuilder.eq;
|
|
17
|
+
exports.exists = require_queryBuilder.exists;
|
|
18
|
+
exports.gt = require_queryBuilder.gt;
|
|
19
|
+
exports.gte = require_queryBuilder.gte;
|
|
20
|
+
exports.hasType = require_queryBuilder.hasType;
|
|
21
|
+
exports.lt = require_queryBuilder.lt;
|
|
22
|
+
exports.lte = require_queryBuilder.lte;
|
|
23
|
+
exports.ne = require_queryBuilder.ne;
|
|
24
|
+
exports.not = require_queryBuilder.not;
|
|
25
|
+
exports.or = require_queryBuilder.or;
|
|
26
|
+
exports.render = require_queryBuilder.render;
|
|
27
|
+
exports.runQuery = require_queryBuilder.runQuery;
|
|
28
|
+
exports.startsWith = require_queryBuilder.startsWith;
|
|
29
|
+
exports.toRpcSelect = require_queryBuilder.toRpcSelect;
|
package/dist/query/index.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { A as startsWith, C as hasType, D as not, E as ne, O as or, S as gte, T as lte, _ as TypeOfNode, a as SelectionFields, b as exists, d as ComparisonOperator, f as ExistsNode, g as StartsWithNode, h as OrNode, i as SelectArg, k as render, l as AndNode, m as NotNode, n as FullEntity, o as toRpcSelect, p as Expression, r as ProjectedEntity, t as EntitySelection, u as ComparisonNode, v as and, w as lt, x as gt, y as eq } from "../selection-DPg0uyJf.cjs";
|
|
2
|
+
import "../index-CV5zCdpa.cjs";
|
|
3
|
+
import "../flags-CRjPpoh3.cjs";
|
|
4
|
+
import { a as QueryErrorKind, c as QueryRequest, i as QueryError, l as QueryResponse, n as QueryResult, o as UnsupportedOperatorError, r as InvalidPredicateError, s as MAX_LIMIT, t as SelectQueryBuilder, u as runQuery } from "../index-BF7Mq9Is.cjs";
|
|
5
|
+
export { AndNode, ComparisonNode, ComparisonOperator, EntitySelection, ExistsNode, Expression, FullEntity, InvalidPredicateError, MAX_LIMIT, NotNode, OrNode, ProjectedEntity, QueryError, QueryErrorKind, QueryRequest, QueryResponse, QueryResult, SelectArg, SelectQueryBuilder, SelectionFields, StartsWithNode, TypeOfNode, UnsupportedOperatorError, and, eq, exists, gt, gte, hasType, lt, lte, ne, not, or, render, runQuery, startsWith, toRpcSelect };
|
package/dist/query/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { A as startsWith, C as hasType, D as not, E as ne, O as or, S as gte, T as lte, _ as TypeOfNode, a as SelectionFields, b as exists, d as ComparisonOperator, f as ExistsNode, g as StartsWithNode, h as OrNode, i as SelectArg, k as render, l as AndNode, m as NotNode, n as FullEntity, o as toRpcSelect, p as Expression, r as ProjectedEntity, t as EntitySelection, u as ComparisonNode, v as and, w as lt, x as gt, y as eq } from "../selection-C4UhsMOO.js";
|
|
2
|
+
import "../codec-Car3KkFF.js";
|
|
3
|
+
import "../index-DvYvrkdk.js";
|
|
4
|
+
import "../flags-5dTNRnow.js";
|
|
5
|
+
import { a as QueryErrorKind, c as QueryRequest, i as QueryError, l as QueryResponse, n as QueryResult, o as UnsupportedOperatorError, r as InvalidPredicateError, s as MAX_LIMIT, t as SelectQueryBuilder, u as runQuery } from "../index-DHDud2hC.js";
|
|
6
|
+
export { AndNode, ComparisonNode, ComparisonOperator, EntitySelection, ExistsNode, Expression, FullEntity, InvalidPredicateError, MAX_LIMIT, NotNode, OrNode, ProjectedEntity, QueryError, QueryErrorKind, QueryRequest, QueryResponse, QueryResult, SelectArg, SelectQueryBuilder, SelectionFields, StartsWithNode, TypeOfNode, UnsupportedOperatorError, and, eq, exists, gt, gte, hasType, lt, lte, ne, not, or, render, runQuery, startsWith, toRpcSelect };
|
package/dist/query/index.js
CHANGED
|
@@ -1,139 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
1
|
+
import "../attributes-BhY5DwJp.js";
|
|
2
|
+
import "../errors-LTe7bOYS.js";
|
|
3
|
+
import "../flags-DFBs2J94.js";
|
|
4
|
+
import "../logger-CVpvU8ik.js";
|
|
5
|
+
import "../attr-GcQKatub.js";
|
|
6
|
+
import "../entity-BYQR1uoe.js";
|
|
7
|
+
import { _ as MAX_LIMIT, a as eq, b as QueryError, c as gte, d as lte, f as ne, g as startsWith, h as render, i as and, l as hasType, m as or, n as QueryResult, o as exists, p as not, r as toRpcSelect, s as gt, t as SelectQueryBuilder, u as lt, v as runQuery, x as UnsupportedOperatorError, y as InvalidPredicateError } from "../queryBuilder-DM6AWCBa.js";
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
function or(...predicates) {
|
|
7
|
-
return {
|
|
8
|
-
type: "or",
|
|
9
|
-
predicates: predicates.flat()
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
function and(...predicates) {
|
|
13
|
-
return {
|
|
14
|
-
type: "and",
|
|
15
|
-
predicates: predicates.flat()
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Creates an equality predicate
|
|
20
|
-
* @param key - The key to compare
|
|
21
|
-
* @param value - The value to compare
|
|
22
|
-
* @returns The equality predicate
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* const predicate = eq("name", "John")
|
|
26
|
-
* // result = { type: "eq", key: "name", value: "John" }
|
|
27
|
-
*/
|
|
28
|
-
function eq(key, value) {
|
|
29
|
-
return {
|
|
30
|
-
type: "eq",
|
|
31
|
-
key,
|
|
32
|
-
value
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Creates a not equal predicate
|
|
37
|
-
* @param key - The key to compare
|
|
38
|
-
* @param value - The value to compare
|
|
39
|
-
* @returns The not equal predicate
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* const predicate = neq("name", "John")
|
|
43
|
-
* // result = { type: "neq", key: "name", value: "John" }
|
|
44
|
-
*/
|
|
45
|
-
function neq(key, value) {
|
|
46
|
-
return {
|
|
47
|
-
type: "neq",
|
|
48
|
-
key,
|
|
49
|
-
value
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Creates a greater than predicate
|
|
54
|
-
* @param key - The key to compare
|
|
55
|
-
* @param value - The value to compare
|
|
56
|
-
* @returns The greater than predicate
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* const predicate = gt("name", "John")
|
|
60
|
-
* // result = { type: "gt", key: "name", value: "John" }
|
|
61
|
-
*/
|
|
62
|
-
function gt(key, value) {
|
|
63
|
-
return {
|
|
64
|
-
type: "gt",
|
|
65
|
-
key,
|
|
66
|
-
value
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Creates a greater than or equal predicate
|
|
71
|
-
* @param key - The key to compare
|
|
72
|
-
* @param value - The value to compare
|
|
73
|
-
* @returns The greater than or equal predicate
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* const predicate = gte("name", "John")
|
|
77
|
-
* // result = { type: "gte", key: "name", value: "John" }
|
|
78
|
-
*/
|
|
79
|
-
function gte(key, value) {
|
|
80
|
-
return {
|
|
81
|
-
type: "gte",
|
|
82
|
-
key,
|
|
83
|
-
value
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Creates a less than predicate
|
|
88
|
-
* @param key - The key to compare
|
|
89
|
-
* @param value - The value to compare
|
|
90
|
-
* @returns The less than predicate
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* const predicate = lt("name", "John")
|
|
94
|
-
* // result = { type: "lt", key: "name", value: "John" }
|
|
95
|
-
*/
|
|
96
|
-
function lt(key, value) {
|
|
97
|
-
return {
|
|
98
|
-
type: "lt",
|
|
99
|
-
key,
|
|
100
|
-
value
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Creates a less than or equal predicate
|
|
105
|
-
* @param key - The key to compare
|
|
106
|
-
* @param value - The value to compare
|
|
107
|
-
* @returns The less than or equal predicate
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* const predicate = lte("name", "John")
|
|
111
|
-
* // result = { type: "lte", key: "name", value: "John" }
|
|
112
|
-
*/
|
|
113
|
-
function lte(key, value) {
|
|
114
|
-
return {
|
|
115
|
-
type: "lte",
|
|
116
|
-
key,
|
|
117
|
-
value
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Creates a not predicate
|
|
122
|
-
* @param key - The key to compare
|
|
123
|
-
* @returns The not predicate
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* const predicate = not("name")
|
|
127
|
-
* // result = { type: "not", key: "name", value: "" }
|
|
128
|
-
*/
|
|
129
|
-
function not(key) {
|
|
130
|
-
return {
|
|
131
|
-
type: "not",
|
|
132
|
-
key,
|
|
133
|
-
value: ""
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
//#endregion
|
|
138
|
-
export { BaseQueryBuilder, QueryBuilder, QueryResult, SelectQueryBuilder, and, asc, desc, eq, gt, gte, lt, lte, neq, not, or, selectionToIncludeData };
|
|
139
|
-
//# sourceMappingURL=index.js.map
|
|
9
|
+
export { InvalidPredicateError, MAX_LIMIT, QueryError, QueryResult, SelectQueryBuilder, UnsupportedOperatorError, and, eq, exists, gt, gte, hasType, lt, lte, ne, not, or, render, runQuery, startsWith, toRpcSelect };
|