@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,153 @@
|
|
|
1
|
+
//#region src/errors.ts
|
|
2
|
+
var EntityMutationError = class extends Error {
|
|
3
|
+
constructor(message, options) {
|
|
4
|
+
super(message, options);
|
|
5
|
+
this.name = "EntityMutationError";
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
var NoMoreResultsError = class extends Error {
|
|
9
|
+
constructor() {
|
|
10
|
+
super("No more results — the last page carried no cursor. Check hasNextPage() before next().");
|
|
11
|
+
this.name = "NoMoreResultsError";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var NoEntityFoundError = class extends Error {
|
|
15
|
+
/** The key that matched nothing, when the lookup was by key. */
|
|
16
|
+
entityKey;
|
|
17
|
+
constructor(entityKey) {
|
|
18
|
+
super(entityKey === void 0 ? "No entity found" : `No live entity with key ${entityKey}. It was never created, or it has been deleted or has expired.`);
|
|
19
|
+
this.name = "NoEntityFoundError";
|
|
20
|
+
this.entityKey = entityKey;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var EmptyPatchError = class extends Error {
|
|
24
|
+
entityKey;
|
|
25
|
+
constructor(entityKey) {
|
|
26
|
+
super(`The patch for entity ${entityKey} has nothing to apply. Pass "set" to write attributes, "unset" to remove them, or "payload"/"contentType" to replace the contents.`);
|
|
27
|
+
this.name = "EmptyPatchError";
|
|
28
|
+
this.entityKey = entityKey;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var InvalidContentTypeError = class extends Error {
|
|
32
|
+
constructor(contentType) {
|
|
33
|
+
super(`Invalid content type "${contentType}". Must follow RFC 2045 MIME grammar and be lowercase only (e.g. "text/plain").`);
|
|
34
|
+
this.name = "InvalidContentTypeError";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/utils/logger.ts
|
|
40
|
+
const ROOT_NAMESPACE = "arkiv";
|
|
41
|
+
function getDebugEnv() {
|
|
42
|
+
if (typeof process !== "undefined") {
|
|
43
|
+
const debugEnv = process?.env?.DEBUG;
|
|
44
|
+
if (debugEnv) return debugEnv;
|
|
45
|
+
}
|
|
46
|
+
if (typeof globalThis !== "undefined" && "localStorage" in globalThis) try {
|
|
47
|
+
return globalThis.localStorage?.getItem("DEBUG") || "";
|
|
48
|
+
} catch {}
|
|
49
|
+
return "";
|
|
50
|
+
}
|
|
51
|
+
function matchesPattern(namespace, pattern) {
|
|
52
|
+
if (pattern === namespace) return true;
|
|
53
|
+
if (pattern.endsWith("*")) {
|
|
54
|
+
const prefix = pattern.slice(0, -1);
|
|
55
|
+
return namespace.startsWith(prefix);
|
|
56
|
+
}
|
|
57
|
+
if (pattern.startsWith("-")) return !matchesPattern(namespace, pattern.slice(1));
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
function isEnabled(namespace) {
|
|
61
|
+
const debugEnv = getDebugEnv();
|
|
62
|
+
if (!debugEnv) return false;
|
|
63
|
+
const patterns = debugEnv.split(/[\s,]+/).filter((p) => p.length > 0);
|
|
64
|
+
if (patterns.length === 0) return false;
|
|
65
|
+
let enabled = false;
|
|
66
|
+
for (const pattern of patterns) if (pattern.startsWith("-")) {
|
|
67
|
+
if (matchesPattern(namespace, pattern)) return false;
|
|
68
|
+
} else if (matchesPattern(namespace, pattern)) enabled = true;
|
|
69
|
+
return enabled;
|
|
70
|
+
}
|
|
71
|
+
const enabledNamespaces = /* @__PURE__ */ new Set();
|
|
72
|
+
const disabledNamespaces = /* @__PURE__ */ new Set();
|
|
73
|
+
const COLOR_PALETTE = [
|
|
74
|
+
"#0000FF",
|
|
75
|
+
"#008000",
|
|
76
|
+
"#FF0000",
|
|
77
|
+
"#FF00FF",
|
|
78
|
+
"#FFA500",
|
|
79
|
+
"#800080",
|
|
80
|
+
"#00CED1",
|
|
81
|
+
"#FF1493",
|
|
82
|
+
"#32CD32",
|
|
83
|
+
"#1E90FF",
|
|
84
|
+
"#FF4500",
|
|
85
|
+
"#9370DB",
|
|
86
|
+
"#00FA9A",
|
|
87
|
+
"#FFD700",
|
|
88
|
+
"#DC143C",
|
|
89
|
+
"#00BFFF",
|
|
90
|
+
"#FF69B4",
|
|
91
|
+
"#20B2AA",
|
|
92
|
+
"#DA70D6",
|
|
93
|
+
"#4682B4"
|
|
94
|
+
];
|
|
95
|
+
const isNode = typeof process !== "undefined" && process.versions?.node != null;
|
|
96
|
+
const ANSI_COLORS = [
|
|
97
|
+
"\x1B[94m",
|
|
98
|
+
"\x1B[92m",
|
|
99
|
+
"\x1B[91m",
|
|
100
|
+
"\x1B[95m",
|
|
101
|
+
"\x1B[93m",
|
|
102
|
+
"\x1B[96m",
|
|
103
|
+
"\x1B[35m",
|
|
104
|
+
"\x1B[36m",
|
|
105
|
+
"\x1B[32m",
|
|
106
|
+
"\x1B[34m",
|
|
107
|
+
"\x1B[33m",
|
|
108
|
+
"\x1B[31m",
|
|
109
|
+
"\x1B[90m",
|
|
110
|
+
"\x1B[37m",
|
|
111
|
+
"\x1B[1m"
|
|
112
|
+
];
|
|
113
|
+
const ANSI_RESET = "\x1B[0m";
|
|
114
|
+
const ANSI_BOLD = "\x1B[1m";
|
|
115
|
+
const namespaceColors = /* @__PURE__ */ new Map();
|
|
116
|
+
function getColorForNamespace(namespace) {
|
|
117
|
+
const cachedColor = namespaceColors.get(namespace);
|
|
118
|
+
if (cachedColor) return cachedColor;
|
|
119
|
+
let hash = 0;
|
|
120
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
121
|
+
const char = namespace.charCodeAt(i);
|
|
122
|
+
hash = (hash << 5) - hash + char;
|
|
123
|
+
hash = hash & hash;
|
|
124
|
+
}
|
|
125
|
+
const colorIndex = Math.abs(hash) % COLOR_PALETTE.length;
|
|
126
|
+
const color = {
|
|
127
|
+
css: COLOR_PALETTE[colorIndex] ?? "inherit",
|
|
128
|
+
ansi: ANSI_COLORS[colorIndex % ANSI_COLORS.length] ?? ""
|
|
129
|
+
};
|
|
130
|
+
namespaceColors.set(namespace, color);
|
|
131
|
+
return color;
|
|
132
|
+
}
|
|
133
|
+
function createDebugLogger(namespace) {
|
|
134
|
+
const colors = getColorForNamespace(namespace);
|
|
135
|
+
return (...args) => {
|
|
136
|
+
const envEnabled = isEnabled(namespace);
|
|
137
|
+
const progEnabled = enabledNamespaces.has(namespace) && !disabledNamespaces.has(namespace);
|
|
138
|
+
if (envEnabled || progEnabled) if (isNode) {
|
|
139
|
+
const coloredNamespace = `${ANSI_BOLD}${colors.ansi}${namespace}${ANSI_RESET}`;
|
|
140
|
+
console.log(coloredNamespace, ...args);
|
|
141
|
+
} else {
|
|
142
|
+
const style1 = `color: ${colors.css}; font-weight: bold`;
|
|
143
|
+
console.log(`%c${namespace}%c`, style1, "color: inherit; font-weight: normal", ...args);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const getLogger = (scope) => {
|
|
148
|
+
return createDebugLogger(`${ROOT_NAMESPACE}:${scope}`);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
//#endregion
|
|
152
|
+
export { NoEntityFoundError as a, InvalidContentTypeError as i, EmptyPatchError as n, NoMoreResultsError as o, EntityMutationError as r, getLogger as t };
|
|
153
|
+
//# sourceMappingURL=logger-CVpvU8ik.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger-CVpvU8ik.js","names":["enabledNamespaces: Set<string>","disabledNamespaces: Set<string>"],"sources":["../src/errors.ts","../src/utils/logger.ts"],"sourcesContent":["export class EntityMutationError extends Error {\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options)\n this.name = \"EntityMutationError\"\n }\n}\nexport class NoMoreResultsError extends Error {\n constructor() {\n super(\"No more results — the last page carried no cursor. Check hasNextPage() before next().\")\n this.name = \"NoMoreResultsError\"\n }\n}\n\nexport class NoEntityFoundError extends Error {\n /** The key that matched nothing, when the lookup was by key. */\n readonly entityKey: string | undefined\n\n constructor(entityKey?: string) {\n super(\n entityKey === undefined\n ? \"No entity found\"\n : `No live entity with key ${entityKey}. It was never created, or it has been deleted or ` +\n \"has expired.\",\n )\n this.name = \"NoEntityFoundError\"\n this.entityKey = entityKey\n }\n}\n\nexport class EmptyPatchError extends Error {\n readonly entityKey: string\n\n constructor(entityKey: string) {\n super(\n `The patch for entity ${entityKey} has nothing to apply. Pass \"set\" to write attributes, ` +\n '\"unset\" to remove them, or \"payload\"/\"contentType\" to replace the contents.',\n )\n this.name = \"EmptyPatchError\"\n this.entityKey = entityKey\n }\n}\n\nexport class InvalidContentTypeError extends Error {\n constructor(contentType: string) {\n super(\n `Invalid content type \"${contentType}\". Must follow RFC 2045 MIME grammar and be lowercase only (e.g. \"text/plain\").`,\n )\n this.name = \"InvalidContentTypeError\"\n }\n}\n","const ROOT_NAMESPACE = \"arkiv\"\n\n// Debug logger type - returns a function that can be called to log messages\ntype DebugLogger = (...args: unknown[]) => void\n\n// Get DEBUG environment variable (works in both Node.js and browser)\nfunction getDebugEnv(): string {\n if (typeof process !== \"undefined\") {\n const debugEnv = process?.env?.DEBUG\n if (debugEnv) {\n return debugEnv\n }\n }\n // Browser: check localStorage\n if (typeof globalThis !== \"undefined\" && \"localStorage\" in globalThis) {\n try {\n const storage = (globalThis as { localStorage?: Storage }).localStorage\n return storage?.getItem(\"DEBUG\") || \"\"\n } catch {\n // localStorage might not be available\n }\n }\n return \"\"\n}\n\n// Parse debug patterns and check if a namespace matches\nfunction matchesPattern(namespace: string, pattern: string): boolean {\n // Exact match\n if (pattern === namespace) return true\n\n // Wildcard match: \"arkiv:*\" matches \"arkiv:query\", \"arkiv:rpc\", etc.\n if (pattern.endsWith(\"*\")) {\n const prefix = pattern.slice(0, -1)\n return namespace.startsWith(prefix)\n }\n\n // Negative match: \"-arkiv:query\" excludes \"arkiv:query\"\n if (pattern.startsWith(\"-\")) {\n const excludePattern = pattern.slice(1)\n return !matchesPattern(namespace, excludePattern)\n }\n\n return false\n}\n\n// Check if a namespace is enabled for debugging\nfunction isEnabled(namespace: string): boolean {\n const debugEnv = getDebugEnv()\n if (!debugEnv) return false\n\n // Split by comma/space and check each pattern\n const patterns = debugEnv.split(/[\\s,]+/).filter((p) => p.length > 0)\n\n // If no patterns, nothing is enabled\n if (patterns.length === 0) return false\n\n // Check if any pattern matches (or if explicitly excluded)\n let enabled = false\n for (const pattern of patterns) {\n if (pattern.startsWith(\"-\")) {\n // Exclude pattern - if it matches, disable\n if (matchesPattern(namespace, pattern)) {\n return false\n }\n } else if (matchesPattern(namespace, pattern)) {\n enabled = true\n }\n }\n\n return enabled\n}\n\n// Store enabled namespaces (for programmatic enable/disable)\nconst enabledNamespaces: Set<string> = new Set()\nconst disabledNamespaces: Set<string> = new Set()\n\n// Color palette for namespace coloring (distinct, readable colors)\nconst COLOR_PALETTE = [\n \"#0000FF\", // blue\n \"#008000\", // green\n \"#FF0000\", // red\n \"#FF00FF\", // magenta\n \"#FFA500\", // orange\n \"#800080\", // purple\n \"#00CED1\", // dark turquoise\n \"#FF1493\", // deep pink\n \"#32CD32\", // lime green\n \"#1E90FF\", // dodger blue\n \"#FF4500\", // orange red\n \"#9370DB\", // medium purple\n \"#00FA9A\", // medium spring green\n \"#FFD700\", // gold\n \"#DC143C\", // crimson\n \"#00BFFF\", // deep sky blue\n \"#FF69B4\", // hot pink\n \"#20B2AA\", // light sea green\n \"#DA70D6\", // orchid\n \"#4682B4\", // steel blue\n]\n\n// Detect if we're in Node.js (for ANSI colors) or browser (for CSS colors)\nconst isNode = typeof process !== \"undefined\" && process.versions?.node != null\n\n// ANSI color codes for Node.js (bright, distinct colors)\nconst ANSI_COLORS = [\n \"\\x1b[94m\", // bright blue\n \"\\x1b[92m\", // bright green\n \"\\x1b[91m\", // bright red\n \"\\x1b[95m\", // bright magenta\n \"\\x1b[93m\", // bright yellow\n \"\\x1b[96m\", // bright cyan\n \"\\x1b[35m\", // magenta\n \"\\x1b[36m\", // cyan\n \"\\x1b[32m\", // green\n \"\\x1b[34m\", // blue\n \"\\x1b[33m\", // yellow\n \"\\x1b[31m\", // red\n \"\\x1b[90m\", // bright black (gray)\n \"\\x1b[37m\", // white\n \"\\x1b[1m\", // bold (as a color option)\n]\n\nconst ANSI_RESET = \"\\x1b[0m\"\nconst ANSI_BOLD = \"\\x1b[1m\"\n\n// Cache colors for namespaces (same namespace = same color)\nconst namespaceColors = new Map<string, { css: string; ansi: string }>()\n\n// Generate a consistent color for a namespace based on its hash\nfunction getColorForNamespace(namespace: string): { css: string; ansi: string } {\n // Check cache first\n const cachedColor = namespaceColors.get(namespace)\n if (cachedColor) {\n return cachedColor\n }\n\n // Simple hash function to convert string to number\n let hash = 0\n for (let i = 0; i < namespace.length; i++) {\n const char = namespace.charCodeAt(i)\n hash = (hash << 5) - hash + char\n hash = hash & hash // Convert to 32-bit integer\n }\n\n // Use absolute value and modulo to get index\n const colorIndex = Math.abs(hash) % COLOR_PALETTE.length\n const cssColor = COLOR_PALETTE[colorIndex] ?? \"inherit\"\n const ansiColor = ANSI_COLORS[colorIndex % ANSI_COLORS.length] ?? \"\"\n\n const color = { css: cssColor, ansi: ansiColor }\n\n // Cache the color\n namespaceColors.set(namespace, color)\n\n return color\n}\n\n// Create a debug logger function\nfunction createDebugLogger(namespace: string): DebugLogger {\n // Get the color for this namespace (consistent across calls)\n const colors = getColorForNamespace(namespace)\n\n return (...args: unknown[]) => {\n // Check if enabled via environment variable or programmatically\n const envEnabled = isEnabled(namespace)\n const progEnabled = enabledNamespaces.has(namespace) && !disabledNamespaces.has(namespace)\n\n if (envEnabled || progEnabled) {\n if (isNode) {\n // Node.js: use ANSI color codes\n const coloredNamespace = `${ANSI_BOLD}${colors.ansi}${namespace}${ANSI_RESET}`\n console.log(coloredNamespace, ...args)\n } else {\n // Browser: use CSS styling with %c\n // The format is: console.log(\"%cstyled%cnormal\", style1, style2, ...args)\n // This colors the namespace, then resets for the rest\n const style1 = `color: ${colors.css}; font-weight: bold`\n const style2 = \"color: inherit; font-weight: normal\"\n // Combine namespace with a space, then log with styles\n console.log(`%c${namespace}%c`, style1, style2, ...args)\n }\n }\n }\n}\n\nexport const getLogger = (scope: string): DebugLogger => {\n const namespace = `${ROOT_NAMESPACE}:${scope}`\n return createDebugLogger(namespace)\n}\n\nexport const enableDebug = (namespaces: string): void => {\n // Parse and add namespaces to enabled set\n const patterns = namespaces.split(/[\\s,]+/).filter((p) => p.length > 0)\n for (const pattern of patterns) {\n if (pattern.startsWith(\"-\")) {\n // Remove from enabled, add to disabled\n const namespace = pattern.slice(1)\n enabledNamespaces.delete(namespace)\n disabledNamespaces.add(namespace)\n } else {\n enabledNamespaces.add(pattern)\n disabledNamespaces.delete(pattern)\n }\n }\n}\n\nexport const disableDebug = (): void => {\n enabledNamespaces.clear()\n disabledNamespaces.clear()\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/errors.ts
|
|
3
|
+
var EntityMutationError = class extends Error {
|
|
4
|
+
constructor(message, options) {
|
|
5
|
+
super(message, options);
|
|
6
|
+
this.name = "EntityMutationError";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
var NoMoreResultsError = class extends Error {
|
|
10
|
+
constructor() {
|
|
11
|
+
super("No more results — the last page carried no cursor. Check hasNextPage() before next().");
|
|
12
|
+
this.name = "NoMoreResultsError";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var NoEntityFoundError = class extends Error {
|
|
16
|
+
/** The key that matched nothing, when the lookup was by key. */
|
|
17
|
+
entityKey;
|
|
18
|
+
constructor(entityKey) {
|
|
19
|
+
super(entityKey === void 0 ? "No entity found" : `No live entity with key ${entityKey}. It was never created, or it has been deleted or has expired.`);
|
|
20
|
+
this.name = "NoEntityFoundError";
|
|
21
|
+
this.entityKey = entityKey;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var EmptyPatchError = class extends Error {
|
|
25
|
+
entityKey;
|
|
26
|
+
constructor(entityKey) {
|
|
27
|
+
super(`The patch for entity ${entityKey} has nothing to apply. Pass "set" to write attributes, "unset" to remove them, or "payload"/"contentType" to replace the contents.`);
|
|
28
|
+
this.name = "EmptyPatchError";
|
|
29
|
+
this.entityKey = entityKey;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var InvalidContentTypeError = class extends Error {
|
|
33
|
+
constructor(contentType) {
|
|
34
|
+
super(`Invalid content type "${contentType}". Must follow RFC 2045 MIME grammar and be lowercase only (e.g. "text/plain").`);
|
|
35
|
+
this.name = "InvalidContentTypeError";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/utils/logger.ts
|
|
41
|
+
const ROOT_NAMESPACE = "arkiv";
|
|
42
|
+
function getDebugEnv() {
|
|
43
|
+
if (typeof process !== "undefined") {
|
|
44
|
+
const debugEnv = process?.env?.DEBUG;
|
|
45
|
+
if (debugEnv) return debugEnv;
|
|
46
|
+
}
|
|
47
|
+
if (typeof globalThis !== "undefined" && "localStorage" in globalThis) try {
|
|
48
|
+
return globalThis.localStorage?.getItem("DEBUG") || "";
|
|
49
|
+
} catch {}
|
|
50
|
+
return "";
|
|
51
|
+
}
|
|
52
|
+
function matchesPattern(namespace, pattern) {
|
|
53
|
+
if (pattern === namespace) return true;
|
|
54
|
+
if (pattern.endsWith("*")) {
|
|
55
|
+
const prefix = pattern.slice(0, -1);
|
|
56
|
+
return namespace.startsWith(prefix);
|
|
57
|
+
}
|
|
58
|
+
if (pattern.startsWith("-")) return !matchesPattern(namespace, pattern.slice(1));
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
function isEnabled(namespace) {
|
|
62
|
+
const debugEnv = getDebugEnv();
|
|
63
|
+
if (!debugEnv) return false;
|
|
64
|
+
const patterns = debugEnv.split(/[\s,]+/).filter((p) => p.length > 0);
|
|
65
|
+
if (patterns.length === 0) return false;
|
|
66
|
+
let enabled = false;
|
|
67
|
+
for (const pattern of patterns) if (pattern.startsWith("-")) {
|
|
68
|
+
if (matchesPattern(namespace, pattern)) return false;
|
|
69
|
+
} else if (matchesPattern(namespace, pattern)) enabled = true;
|
|
70
|
+
return enabled;
|
|
71
|
+
}
|
|
72
|
+
const enabledNamespaces = /* @__PURE__ */ new Set();
|
|
73
|
+
const disabledNamespaces = /* @__PURE__ */ new Set();
|
|
74
|
+
const COLOR_PALETTE = [
|
|
75
|
+
"#0000FF",
|
|
76
|
+
"#008000",
|
|
77
|
+
"#FF0000",
|
|
78
|
+
"#FF00FF",
|
|
79
|
+
"#FFA500",
|
|
80
|
+
"#800080",
|
|
81
|
+
"#00CED1",
|
|
82
|
+
"#FF1493",
|
|
83
|
+
"#32CD32",
|
|
84
|
+
"#1E90FF",
|
|
85
|
+
"#FF4500",
|
|
86
|
+
"#9370DB",
|
|
87
|
+
"#00FA9A",
|
|
88
|
+
"#FFD700",
|
|
89
|
+
"#DC143C",
|
|
90
|
+
"#00BFFF",
|
|
91
|
+
"#FF69B4",
|
|
92
|
+
"#20B2AA",
|
|
93
|
+
"#DA70D6",
|
|
94
|
+
"#4682B4"
|
|
95
|
+
];
|
|
96
|
+
const isNode = typeof process !== "undefined" && process.versions?.node != null;
|
|
97
|
+
const ANSI_COLORS = [
|
|
98
|
+
"\x1B[94m",
|
|
99
|
+
"\x1B[92m",
|
|
100
|
+
"\x1B[91m",
|
|
101
|
+
"\x1B[95m",
|
|
102
|
+
"\x1B[93m",
|
|
103
|
+
"\x1B[96m",
|
|
104
|
+
"\x1B[35m",
|
|
105
|
+
"\x1B[36m",
|
|
106
|
+
"\x1B[32m",
|
|
107
|
+
"\x1B[34m",
|
|
108
|
+
"\x1B[33m",
|
|
109
|
+
"\x1B[31m",
|
|
110
|
+
"\x1B[90m",
|
|
111
|
+
"\x1B[37m",
|
|
112
|
+
"\x1B[1m"
|
|
113
|
+
];
|
|
114
|
+
const ANSI_RESET = "\x1B[0m";
|
|
115
|
+
const ANSI_BOLD = "\x1B[1m";
|
|
116
|
+
const namespaceColors = /* @__PURE__ */ new Map();
|
|
117
|
+
function getColorForNamespace(namespace) {
|
|
118
|
+
const cachedColor = namespaceColors.get(namespace);
|
|
119
|
+
if (cachedColor) return cachedColor;
|
|
120
|
+
let hash = 0;
|
|
121
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
122
|
+
const char = namespace.charCodeAt(i);
|
|
123
|
+
hash = (hash << 5) - hash + char;
|
|
124
|
+
hash = hash & hash;
|
|
125
|
+
}
|
|
126
|
+
const colorIndex = Math.abs(hash) % COLOR_PALETTE.length;
|
|
127
|
+
const color = {
|
|
128
|
+
css: COLOR_PALETTE[colorIndex] ?? "inherit",
|
|
129
|
+
ansi: ANSI_COLORS[colorIndex % ANSI_COLORS.length] ?? ""
|
|
130
|
+
};
|
|
131
|
+
namespaceColors.set(namespace, color);
|
|
132
|
+
return color;
|
|
133
|
+
}
|
|
134
|
+
function createDebugLogger(namespace) {
|
|
135
|
+
const colors = getColorForNamespace(namespace);
|
|
136
|
+
return (...args) => {
|
|
137
|
+
const envEnabled = isEnabled(namespace);
|
|
138
|
+
const progEnabled = enabledNamespaces.has(namespace) && !disabledNamespaces.has(namespace);
|
|
139
|
+
if (envEnabled || progEnabled) if (isNode) {
|
|
140
|
+
const coloredNamespace = `${ANSI_BOLD}${colors.ansi}${namespace}${ANSI_RESET}`;
|
|
141
|
+
console.log(coloredNamespace, ...args);
|
|
142
|
+
} else {
|
|
143
|
+
const style1 = `color: ${colors.css}; font-weight: bold`;
|
|
144
|
+
console.log(`%c${namespace}%c`, style1, "color: inherit; font-weight: normal", ...args);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
const getLogger = (scope) => {
|
|
149
|
+
return createDebugLogger(`${ROOT_NAMESPACE}:${scope}`);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
//#endregion
|
|
153
|
+
Object.defineProperty(exports, 'EmptyPatchError', {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
get: function () {
|
|
156
|
+
return EmptyPatchError;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
Object.defineProperty(exports, 'EntityMutationError', {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
get: function () {
|
|
162
|
+
return EntityMutationError;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
Object.defineProperty(exports, 'InvalidContentTypeError', {
|
|
166
|
+
enumerable: true,
|
|
167
|
+
get: function () {
|
|
168
|
+
return InvalidContentTypeError;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
Object.defineProperty(exports, 'NoEntityFoundError', {
|
|
172
|
+
enumerable: true,
|
|
173
|
+
get: function () {
|
|
174
|
+
return NoEntityFoundError;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
Object.defineProperty(exports, 'NoMoreResultsError', {
|
|
178
|
+
enumerable: true,
|
|
179
|
+
get: function () {
|
|
180
|
+
return NoMoreResultsError;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
Object.defineProperty(exports, 'getLogger', {
|
|
184
|
+
enumerable: true,
|
|
185
|
+
get: function () {
|
|
186
|
+
return getLogger;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { i as Lifetime, n as Expiry } from "./expiry-DRV29F1r.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/expirationTime.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The optional floor a deadline can carry.
|
|
7
|
+
*
|
|
8
|
+
* `atLeast` takes a duration — one of the `from*` helpers — and never another deadline, so
|
|
9
|
+
* `atBlock(x, { atLeast: atBlock(y) })` does not compile. Two deadlines are not a thing the engine
|
|
10
|
+
* can resolve.
|
|
11
|
+
*/
|
|
12
|
+
type DeadlineOptions = {
|
|
13
|
+
/** Live at least this long from now, even if the deadline is sooner. */
|
|
14
|
+
atLeast?: Lifetime | undefined;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Builds the `expires` of a create or an extension.
|
|
18
|
+
*
|
|
19
|
+
* Every helper returns the `{ minLifetime, expiresAt }` pair the ABI carries, so what you write is
|
|
20
|
+
* what goes on the wire. The `from*` helpers fill `minLifetime` and leave `expiresAt` at `0n`;
|
|
21
|
+
* {@link ExpirationTime.atBlock} and {@link ExpirationTime.atDate} do the reverse. The engine takes
|
|
22
|
+
* whichever comes later, which is why a deadline can also carry a floor.
|
|
23
|
+
*
|
|
24
|
+
* Values are plain data — no methods, no prototype — so they log, clone and compare like any other
|
|
25
|
+
* object.
|
|
26
|
+
*
|
|
27
|
+
* @example The 90% case: a duration, and nothing else to think about.
|
|
28
|
+
* await client.createEntity({ payload, contentType, expires: ExpirationTime.fromDays(30) })
|
|
29
|
+
*
|
|
30
|
+
* @example An exact block, or a wall-clock date.
|
|
31
|
+
* expires: ExpirationTime.atBlock(1_200_000n)
|
|
32
|
+
* expires: ExpirationTime.atDate(new Date("2027-01-01"))
|
|
33
|
+
*
|
|
34
|
+
* @example A deadline that still guarantees a minimum life.
|
|
35
|
+
* expires: ExpirationTime.atBlock(1_200_000n, { atLeast: ExpirationTime.fromDays(1) })
|
|
36
|
+
*/
|
|
37
|
+
declare const ExpirationTime: {
|
|
38
|
+
/**
|
|
39
|
+
* A raw number of seconds. Must be a whole number of blocks' worth — see the other helpers, which
|
|
40
|
+
* all produce one by construction.
|
|
41
|
+
*
|
|
42
|
+
* @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
|
|
43
|
+
*/
|
|
44
|
+
fromSeconds: (seconds: number) => Lifetime;
|
|
45
|
+
fromMinutes: (minutes: number) => Lifetime;
|
|
46
|
+
fromHours: (hours: number) => Lifetime;
|
|
47
|
+
fromDays: (days: number) => Lifetime;
|
|
48
|
+
fromWeeks: (weeks: number) => Lifetime;
|
|
49
|
+
fromMonths: (months: number) => Lifetime;
|
|
50
|
+
fromYears: (years: number) => Lifetime;
|
|
51
|
+
/**
|
|
52
|
+
* A number of blocks, for callers who think in the chain's own unit. Always exact — there is no
|
|
53
|
+
* conversion to be approximate about.
|
|
54
|
+
*
|
|
55
|
+
* @throws {InvalidExpiryError} If the count is not a positive whole number.
|
|
56
|
+
*/
|
|
57
|
+
fromBlocks: (blocks: number) => Lifetime;
|
|
58
|
+
/**
|
|
59
|
+
* An absolute block height.
|
|
60
|
+
*
|
|
61
|
+
* @param block - The block the entity expires at.
|
|
62
|
+
* @param options - Optionally, a floor: `{ atLeast: ExpirationTime.fromDays(1) }`.
|
|
63
|
+
* @throws {InvalidExpiryError} If the height is negative.
|
|
64
|
+
*/
|
|
65
|
+
atBlock: (block: bigint, options?: DeadlineOptions) => Expiry;
|
|
66
|
+
/**
|
|
67
|
+
* A wall-clock instant, placed against the block the transaction is built on.
|
|
68
|
+
*
|
|
69
|
+
* A date cannot land on a block boundary in general, so it rounds **up** to the next block: the
|
|
70
|
+
* entity lives until at least the instant asked for. This is why a date is never rejected for
|
|
71
|
+
* "not being a whole number of blocks" the way a duration is — it becomes a block height, not a
|
|
72
|
+
* duration.
|
|
73
|
+
*
|
|
74
|
+
* @param date - When the entity should expire.
|
|
75
|
+
* @param options - Optionally, a floor: `{ atLeast: ExpirationTime.fromDays(1) }`.
|
|
76
|
+
* @throws {InvalidExpiryError} If the value is not a valid `Date`.
|
|
77
|
+
*/
|
|
78
|
+
atDate: (date: Date, options?: DeadlineOptions) => Expiry;
|
|
79
|
+
/**
|
|
80
|
+
* An entity that should never expire.
|
|
81
|
+
*
|
|
82
|
+
* This is `atBlock(MAX_EXPIRES_AT)` — the largest expiry the `uint64` field holds — and the
|
|
83
|
+
* engine treats it as an ordinary deadline rather than a special case. There is no permanence
|
|
84
|
+
* flag; a block height no chain will reach is what permanence is.
|
|
85
|
+
*/
|
|
86
|
+
permanent: () => Expiry;
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/utils/payload.d.ts
|
|
90
|
+
declare function jsonToPayload(json: object): Uint8Array;
|
|
91
|
+
declare function stringToPayload(data: string): Uint8Array;
|
|
92
|
+
//#endregion
|
|
93
|
+
export { ExpirationTime as i, stringToPayload as n, DeadlineOptions as r, jsonToPayload as t };
|
|
94
|
+
//# sourceMappingURL=payload-BNoud2KZ.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-BNoud2KZ.d.cts","names":[],"sources":["../src/utils/expirationTime.ts","../src/utils/payload.ts"],"sourcesContent":[],"mappings":";;;;;;AAWA;AAkCA;;;;AAU4B,KA5ChB,eAAA,GA4CgB;EACE;EACE,OAAA,CAAA,EA5CpB,QA4CoB,GAAA,SAAA;CACF;;;;;;;;;;;;ACxD9B;AAIA;;;;;;;;;cDuCa;;;;;;;oCAOqB;oCACA;gCACJ;8BACF;gCACE;kCACE;gCACF;;;;;;;kCAQE;;;;;;;;qCAgBK,oBAAkB;;;;;;;;;;;;;iBAmBtC,gBAAgB,oBAAkB;;;;;;;;mBAclC;;;;iBCjHD,aAAA,gBAA6B;iBAI7B,eAAA,gBAA+B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { i as MAX_EXPIRES_AT, r as toBlocks, t as makeExpiry } from "./expiry-BjpxZZQU.js";
|
|
2
|
+
import { n as InvalidExpiryError } from "./errors-LTe7bOYS.js";
|
|
3
|
+
import { stringToBytes, toBytes } from "viem";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/expirationTime.ts
|
|
6
|
+
function lifetimeOf(seconds) {
|
|
7
|
+
return makeExpiry(toBlocks(seconds), 0n);
|
|
8
|
+
}
|
|
9
|
+
function deadlineOf(expiresAt, options) {
|
|
10
|
+
return 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 InvalidExpiryError(`a lifetime must be a positive whole number of blocks, got ${blocks}`);
|
|
43
|
+
return makeExpiry(BigInt(blocks), 0n);
|
|
44
|
+
},
|
|
45
|
+
atBlock: (block, options) => {
|
|
46
|
+
if (typeof block !== "bigint" || block < 0n) throw new 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 InvalidExpiryError(`a deadline must be a valid Date, got ${String(date)}`);
|
|
51
|
+
return deadlineOf(date, options);
|
|
52
|
+
},
|
|
53
|
+
permanent: () => deadlineOf(MAX_EXPIRES_AT)
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/utils/payload.ts
|
|
58
|
+
function jsonToPayload(json) {
|
|
59
|
+
return toBytes(JSON.stringify(json));
|
|
60
|
+
}
|
|
61
|
+
function stringToPayload(data) {
|
|
62
|
+
return stringToBytes(data);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { stringToPayload as n, ExpirationTime as r, jsonToPayload as t };
|
|
67
|
+
//# sourceMappingURL=payload-Bz6651ax.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-Bz6651ax.js","names":[],"sources":["../src/utils/expirationTime.ts","../src/utils/payload.ts"],"sourcesContent":["import { InvalidExpiryError } from \"../entity/errors\"\nimport { type Expiry, type Lifetime, makeExpiry, toBlocks } from \"../entity/expiry\"\nimport { MAX_EXPIRES_AT } from \"../entity/params\"\n\n/**\n * The optional floor a deadline can carry.\n *\n * `atLeast` takes a duration — one of the `from*` helpers — and never another deadline, so\n * `atBlock(x, { atLeast: atBlock(y) })` does not compile. Two deadlines are not a thing the engine\n * can resolve.\n */\nexport type DeadlineOptions = {\n /** Live at least this long from now, even if the deadline is sooner. */\n atLeast?: Lifetime | undefined\n}\n\nfunction lifetimeOf(seconds: number): Lifetime {\n return makeExpiry(toBlocks(seconds), 0n) as Lifetime\n}\n\nfunction deadlineOf(expiresAt: bigint | Date, options?: DeadlineOptions): Expiry {\n return makeExpiry(options?.atLeast?.minLifetime ?? 0n, expiresAt)\n}\n\n/**\n * Builds the `expires` of a create or an extension.\n *\n * Every helper returns the `{ minLifetime, expiresAt }` pair the ABI carries, so what you write is\n * what goes on the wire. The `from*` helpers fill `minLifetime` and leave `expiresAt` at `0n`;\n * {@link ExpirationTime.atBlock} and {@link ExpirationTime.atDate} do the reverse. The engine takes\n * whichever comes later, which is why a deadline can also carry a floor.\n *\n * Values are plain data — no methods, no prototype — so they log, clone and compare like any other\n * object.\n *\n * @example The 90% case: a duration, and nothing else to think about.\n * await client.createEntity({ payload, contentType, expires: ExpirationTime.fromDays(30) })\n *\n * @example An exact block, or a wall-clock date.\n * expires: ExpirationTime.atBlock(1_200_000n)\n * expires: ExpirationTime.atDate(new Date(\"2027-01-01\"))\n *\n * @example A deadline that still guarantees a minimum life.\n * expires: ExpirationTime.atBlock(1_200_000n, { atLeast: ExpirationTime.fromDays(1) })\n */\nexport const ExpirationTime = {\n /**\n * A raw number of seconds. Must be a whole number of blocks' worth — see the other helpers, which\n * all produce one by construction.\n *\n * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.\n */\n fromSeconds: (seconds: number): Lifetime => lifetimeOf(seconds),\n fromMinutes: (minutes: number): Lifetime => lifetimeOf(minutes * 60),\n fromHours: (hours: number): Lifetime => lifetimeOf(hours * 60 * 60),\n fromDays: (days: number): Lifetime => lifetimeOf(days * 24 * 60 * 60),\n fromWeeks: (weeks: number): Lifetime => lifetimeOf(weeks * 7 * 24 * 60 * 60),\n fromMonths: (months: number): Lifetime => lifetimeOf(months * 30 * 24 * 60 * 60),\n fromYears: (years: number): Lifetime => lifetimeOf(years * 365 * 24 * 60 * 60),\n\n /**\n * A number of blocks, for callers who think in the chain's own unit. Always exact — there is no\n * conversion to be approximate about.\n *\n * @throws {InvalidExpiryError} If the count is not a positive whole number.\n */\n fromBlocks: (blocks: number): Lifetime => {\n if (!Number.isInteger(blocks) || blocks <= 0) {\n throw new InvalidExpiryError(\n `a lifetime must be a positive whole number of blocks, got ${blocks}`,\n )\n }\n return makeExpiry(BigInt(blocks), 0n) as Lifetime\n },\n\n /**\n * An absolute block height.\n *\n * @param block - The block the entity expires at.\n * @param options - Optionally, a floor: `{ atLeast: ExpirationTime.fromDays(1) }`.\n * @throws {InvalidExpiryError} If the height is negative.\n */\n atBlock: (block: bigint, options?: DeadlineOptions): Expiry => {\n if (typeof block !== \"bigint\" || block < 0n) {\n throw new InvalidExpiryError(`a deadline must be a non-negative block height, got ${block}`)\n }\n return deadlineOf(block, options)\n },\n\n /**\n * A wall-clock instant, placed against the block the transaction is built on.\n *\n * A date cannot land on a block boundary in general, so it rounds **up** to the next block: the\n * entity lives until at least the instant asked for. This is why a date is never rejected for\n * \"not being a whole number of blocks\" the way a duration is — it becomes a block height, not a\n * duration.\n *\n * @param date - When the entity should expire.\n * @param options - Optionally, a floor: `{ atLeast: ExpirationTime.fromDays(1) }`.\n * @throws {InvalidExpiryError} If the value is not a valid `Date`.\n */\n atDate: (date: Date, options?: DeadlineOptions): Expiry => {\n if (!(date instanceof Date) || Number.isNaN(date.getTime())) {\n throw new InvalidExpiryError(`a deadline must be a valid Date, got ${String(date)}`)\n }\n return deadlineOf(date, options)\n },\n\n /**\n * An entity that should never expire.\n *\n * This is `atBlock(MAX_EXPIRES_AT)` — the largest expiry the `uint64` field holds — and the\n * engine treats it as an ordinary deadline rather than a special case. There is no permanence\n * flag; a block height no chain will reach is what permanence is.\n */\n permanent: (): Expiry => deadlineOf(MAX_EXPIRES_AT),\n}\n","import { stringToBytes, toBytes } from \"viem\"\n\nexport function jsonToPayload(json: object): Uint8Array {\n return toBytes(JSON.stringify(json))\n}\n\nexport function stringToPayload(data: string): Uint8Array {\n // stringToBytes, not toBytes: toBytes hex-decodes hex-looking strings, which\n // would corrupt payloads like \"0xab\" instead of UTF-8 encoding them\n return stringToBytes(data)\n}\n"],"mappings":";;;;;AAgBA,SAAS,WAAW,SAA2B;AAC7C,QAAO,WAAW,SAAS,QAAQ,EAAE,GAAG;;AAG1C,SAAS,WAAW,WAA0B,SAAmC;AAC/E,QAAO,WAAW,SAAS,SAAS,eAAe,IAAI,UAAU;;;;;;;;;;;;;;;;;;;;;;;AAwBnE,MAAa,iBAAiB;CAO5B,cAAc,YAA8B,WAAW,QAAQ;CAC/D,cAAc,YAA8B,WAAW,UAAU,GAAG;CACpE,YAAY,UAA4B,WAAW,QAAQ,KAAK,GAAG;CACnE,WAAW,SAA2B,WAAW,OAAO,KAAK,KAAK,GAAG;CACrE,YAAY,UAA4B,WAAW,QAAQ,IAAI,KAAK,KAAK,GAAG;CAC5E,aAAa,WAA6B,WAAW,SAAS,KAAK,KAAK,KAAK,GAAG;CAChF,YAAY,UAA4B,WAAW,QAAQ,MAAM,KAAK,KAAK,GAAG;CAQ9E,aAAa,WAA6B;AACxC,MAAI,CAAC,OAAO,UAAU,OAAO,IAAI,UAAU,EACzC,OAAM,IAAI,mBACR,6DAA6D,SAC9D;AAEH,SAAO,WAAW,OAAO,OAAO,EAAE,GAAG;;CAUvC,UAAU,OAAe,YAAsC;AAC7D,MAAI,OAAO,UAAU,YAAY,QAAQ,GACvC,OAAM,IAAI,mBAAmB,uDAAuD,QAAQ;AAE9F,SAAO,WAAW,OAAO,QAAQ;;CAenC,SAAS,MAAY,YAAsC;AACzD,MAAI,EAAE,gBAAgB,SAAS,OAAO,MAAM,KAAK,SAAS,CAAC,CACzD,OAAM,IAAI,mBAAmB,wCAAwC,OAAO,KAAK,GAAG;AAEtF,SAAO,WAAW,MAAM,QAAQ;;CAUlC,iBAAyB,WAAW,eAAe;CACpD;;;;AClHD,SAAgB,cAAc,MAA0B;AACtD,QAAO,QAAQ,KAAK,UAAU,KAAK,CAAC;;AAGtC,SAAgB,gBAAgB,MAA0B;AAGxD,QAAO,cAAc,KAAK"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { i as Lifetime, n as Expiry } from "./expiry-nDbCgZX4.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/expirationTime.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The optional floor a deadline can carry.
|
|
7
|
+
*
|
|
8
|
+
* `atLeast` takes a duration — one of the `from*` helpers — and never another deadline, so
|
|
9
|
+
* `atBlock(x, { atLeast: atBlock(y) })` does not compile. Two deadlines are not a thing the engine
|
|
10
|
+
* can resolve.
|
|
11
|
+
*/
|
|
12
|
+
type DeadlineOptions = {
|
|
13
|
+
/** Live at least this long from now, even if the deadline is sooner. */
|
|
14
|
+
atLeast?: Lifetime | undefined;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Builds the `expires` of a create or an extension.
|
|
18
|
+
*
|
|
19
|
+
* Every helper returns the `{ minLifetime, expiresAt }` pair the ABI carries, so what you write is
|
|
20
|
+
* what goes on the wire. The `from*` helpers fill `minLifetime` and leave `expiresAt` at `0n`;
|
|
21
|
+
* {@link ExpirationTime.atBlock} and {@link ExpirationTime.atDate} do the reverse. The engine takes
|
|
22
|
+
* whichever comes later, which is why a deadline can also carry a floor.
|
|
23
|
+
*
|
|
24
|
+
* Values are plain data — no methods, no prototype — so they log, clone and compare like any other
|
|
25
|
+
* object.
|
|
26
|
+
*
|
|
27
|
+
* @example The 90% case: a duration, and nothing else to think about.
|
|
28
|
+
* await client.createEntity({ payload, contentType, expires: ExpirationTime.fromDays(30) })
|
|
29
|
+
*
|
|
30
|
+
* @example An exact block, or a wall-clock date.
|
|
31
|
+
* expires: ExpirationTime.atBlock(1_200_000n)
|
|
32
|
+
* expires: ExpirationTime.atDate(new Date("2027-01-01"))
|
|
33
|
+
*
|
|
34
|
+
* @example A deadline that still guarantees a minimum life.
|
|
35
|
+
* expires: ExpirationTime.atBlock(1_200_000n, { atLeast: ExpirationTime.fromDays(1) })
|
|
36
|
+
*/
|
|
37
|
+
declare const ExpirationTime: {
|
|
38
|
+
/**
|
|
39
|
+
* A raw number of seconds. Must be a whole number of blocks' worth — see the other helpers, which
|
|
40
|
+
* all produce one by construction.
|
|
41
|
+
*
|
|
42
|
+
* @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
|
|
43
|
+
*/
|
|
44
|
+
fromSeconds: (seconds: number) => Lifetime;
|
|
45
|
+
fromMinutes: (minutes: number) => Lifetime;
|
|
46
|
+
fromHours: (hours: number) => Lifetime;
|
|
47
|
+
fromDays: (days: number) => Lifetime;
|
|
48
|
+
fromWeeks: (weeks: number) => Lifetime;
|
|
49
|
+
fromMonths: (months: number) => Lifetime;
|
|
50
|
+
fromYears: (years: number) => Lifetime;
|
|
51
|
+
/**
|
|
52
|
+
* A number of blocks, for callers who think in the chain's own unit. Always exact — there is no
|
|
53
|
+
* conversion to be approximate about.
|
|
54
|
+
*
|
|
55
|
+
* @throws {InvalidExpiryError} If the count is not a positive whole number.
|
|
56
|
+
*/
|
|
57
|
+
fromBlocks: (blocks: number) => Lifetime;
|
|
58
|
+
/**
|
|
59
|
+
* An absolute block height.
|
|
60
|
+
*
|
|
61
|
+
* @param block - The block the entity expires at.
|
|
62
|
+
* @param options - Optionally, a floor: `{ atLeast: ExpirationTime.fromDays(1) }`.
|
|
63
|
+
* @throws {InvalidExpiryError} If the height is negative.
|
|
64
|
+
*/
|
|
65
|
+
atBlock: (block: bigint, options?: DeadlineOptions) => Expiry;
|
|
66
|
+
/**
|
|
67
|
+
* A wall-clock instant, placed against the block the transaction is built on.
|
|
68
|
+
*
|
|
69
|
+
* A date cannot land on a block boundary in general, so it rounds **up** to the next block: the
|
|
70
|
+
* entity lives until at least the instant asked for. This is why a date is never rejected for
|
|
71
|
+
* "not being a whole number of blocks" the way a duration is — it becomes a block height, not a
|
|
72
|
+
* duration.
|
|
73
|
+
*
|
|
74
|
+
* @param date - When the entity should expire.
|
|
75
|
+
* @param options - Optionally, a floor: `{ atLeast: ExpirationTime.fromDays(1) }`.
|
|
76
|
+
* @throws {InvalidExpiryError} If the value is not a valid `Date`.
|
|
77
|
+
*/
|
|
78
|
+
atDate: (date: Date, options?: DeadlineOptions) => Expiry;
|
|
79
|
+
/**
|
|
80
|
+
* An entity that should never expire.
|
|
81
|
+
*
|
|
82
|
+
* This is `atBlock(MAX_EXPIRES_AT)` — the largest expiry the `uint64` field holds — and the
|
|
83
|
+
* engine treats it as an ordinary deadline rather than a special case. There is no permanence
|
|
84
|
+
* flag; a block height no chain will reach is what permanence is.
|
|
85
|
+
*/
|
|
86
|
+
permanent: () => Expiry;
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/utils/payload.d.ts
|
|
90
|
+
declare function jsonToPayload(json: object): Uint8Array;
|
|
91
|
+
declare function stringToPayload(data: string): Uint8Array;
|
|
92
|
+
//#endregion
|
|
93
|
+
export { ExpirationTime as i, stringToPayload as n, DeadlineOptions as r, jsonToPayload as t };
|
|
94
|
+
//# sourceMappingURL=payload-CcUj85ys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-CcUj85ys.d.ts","names":[],"sources":["../src/utils/expirationTime.ts","../src/utils/payload.ts"],"sourcesContent":[],"mappings":";;;;;;AAWA;AAkCA;;;;AAU4B,KA5ChB,eAAA,GA4CgB;EACE;EACE,OAAA,CAAA,EA5CpB,QA4CoB,GAAA,SAAA;CACF;;;;;;;;;;;;ACxD9B;AAIA;;;;;;;;;cDuCa;;;;;;;oCAOqB;oCACA;gCACJ;8BACF;gCACE;kCACE;gCACF;;;;;;;kCAQE;;;;;;;;qCAgBK,oBAAkB;;;;;;;;;;;;;iBAmBtC,gBAAgB,oBAAkB;;;;;;;;mBAclC;;;;iBCjHD,aAAA,gBAA6B;iBAI7B,eAAA,gBAA+B"}
|