@latticexyz/store 2.2.18-9fa07c8489f1fbf167d0db01cd9aaa645a29c8e2 → 2.2.18-c2ad22c7feb566e1731ff16e8be291746bdffb3e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-4TACS4IT.js +2 -0
- package/dist/{chunk-Y2IOLXYI.js.map → chunk-4TACS4IT.js.map} +1 -1
- package/dist/chunk-5YJ4WITG.js +2 -0
- package/dist/{chunk-YO3UX5MT.js.map → chunk-5YJ4WITG.js.map} +1 -1
- package/dist/codegen.js +210 -1005
- package/dist/codegen.js.map +1 -1
- package/dist/index.js +1 -22
- package/dist/internal.js +1 -302
- package/dist/internal.js.map +1 -1
- package/dist/mud.config.js +1 -60
- package/dist/mud.config.js.map +1 -1
- package/package.json +11 -47
- package/dist/chunk-Y2IOLXYI.js +0 -27
- package/dist/chunk-YO3UX5MT.js +0 -460
- package/dist/codegen.cjs +0 -1270
- package/dist/codegen.cjs.map +0 -1
- package/dist/codegen.d.cts +0 -173
- package/dist/index.cjs +0 -449
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -15
- package/dist/internal.cjs +0 -756
- package/dist/internal.cjs.map +0 -1
- package/dist/internal.d.cts +0 -88
- package/dist/mud.config.cjs +0 -468
- package/dist/mud.config.cjs.map +0 -1
- package/dist/mud.config.d.cts +0 -295
- package/dist/output-DjNNBwhs.d.cts +0 -215
- package/dist/store-7QsNcifl.d.cts +0 -326
package/dist/codegen.cjs
DELETED
@@ -1,1270 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __create = Object.create;
|
3
|
-
var __defProp = Object.defineProperty;
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
-
var __export = (target, all) => {
|
9
|
-
for (var name in all)
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
-
};
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
-
for (let key of __getOwnPropNames(from))
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
-
}
|
18
|
-
return to;
|
19
|
-
};
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
-
mod
|
27
|
-
));
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
|
30
|
-
// ts/codegen/index.ts
|
31
|
-
var codegen_exports = {};
|
32
|
-
__export(codegen_exports, {
|
33
|
-
getSchemaTypeInfo: () => getSchemaTypeInfo,
|
34
|
-
getTableOptions: () => getTableOptions,
|
35
|
-
getUserTypeInfo: () => getUserTypeInfo,
|
36
|
-
renderDecodeSlice: () => renderDecodeSlice,
|
37
|
-
renderDecodeValueType: () => renderDecodeValueType,
|
38
|
-
renderDeleteRecordMethods: () => renderDeleteRecordMethods,
|
39
|
-
renderEncodeArray: () => renderEncodeArray,
|
40
|
-
renderEncodeFieldSingle: () => renderEncodeFieldSingle,
|
41
|
-
renderFieldMethods: () => renderFieldMethods,
|
42
|
-
renderRecordData: () => renderRecordData,
|
43
|
-
renderRecordMethods: () => renderRecordMethods,
|
44
|
-
renderTable: () => renderTable,
|
45
|
-
renderTightCoderAutoTest: () => renderTightCoderAutoTest,
|
46
|
-
renderTightCoderAutoTestFunction: () => renderTightCoderAutoTestFunction,
|
47
|
-
renderTightCoderDecode: () => renderTightCoderDecode,
|
48
|
-
renderTightCoderEncode: () => renderTightCoderEncode,
|
49
|
-
renderTypesFromConfig: () => renderTypesFromConfig,
|
50
|
-
resolveAbiOrUserType: () => resolveAbiOrUserType,
|
51
|
-
tablegen: () => tablegen
|
52
|
-
});
|
53
|
-
module.exports = __toCommonJS(codegen_exports);
|
54
|
-
|
55
|
-
// ts/codegen/field.ts
|
56
|
-
var import_codegen = require("@latticexyz/common/codegen");
|
57
|
-
function renderFieldMethods(options) {
|
58
|
-
const storeArgument = options.storeArgument;
|
59
|
-
const { _typedTableId, _typedKeyArgs, _keyTupleDefinition } = (0, import_codegen.renderCommonData)(options);
|
60
|
-
let result = "";
|
61
|
-
for (const [schemaIndex, field] of options.fields.entries()) {
|
62
|
-
if (!options.withDynamicFieldMethods && field.isDynamic) {
|
63
|
-
continue;
|
64
|
-
}
|
65
|
-
const _typedFieldName = `${field.typeWithLocation} ${field.name}`;
|
66
|
-
if (options.withGetters) {
|
67
|
-
result += (0, import_codegen.renderWithFieldSuffix)(
|
68
|
-
options.withSuffixlessFieldMethods,
|
69
|
-
field.name,
|
70
|
-
(_methodNameSuffix) => (0, import_codegen.renderWithStore)(
|
71
|
-
storeArgument,
|
72
|
-
({ _typedStore, _store, _commentSuffix, _methodNamePrefix }) => `
|
73
|
-
/**
|
74
|
-
* @notice Get ${field.name}${_commentSuffix}.
|
75
|
-
*/
|
76
|
-
function ${_methodNamePrefix}get${_methodNameSuffix}(${(0, import_codegen.renderArguments)([
|
77
|
-
_typedStore,
|
78
|
-
_typedTableId,
|
79
|
-
_typedKeyArgs
|
80
|
-
])}) internal view returns (${_typedFieldName}) {
|
81
|
-
${_keyTupleDefinition}
|
82
|
-
${field.isDynamic ? `bytes memory _blob = ${_store}.getDynamicField(
|
83
|
-
_tableId,
|
84
|
-
_keyTuple,
|
85
|
-
${schemaIndex - options.staticFields.length}
|
86
|
-
);` : `bytes32 _blob = ${_store}.getStaticField(
|
87
|
-
_tableId,
|
88
|
-
_keyTuple,
|
89
|
-
${schemaIndex},
|
90
|
-
_fieldLayout
|
91
|
-
);`}
|
92
|
-
return ${renderDecodeFieldSingle(field)};
|
93
|
-
}
|
94
|
-
`
|
95
|
-
)
|
96
|
-
);
|
97
|
-
}
|
98
|
-
result += (0, import_codegen.renderWithFieldSuffix)(
|
99
|
-
options.withSuffixlessFieldMethods,
|
100
|
-
field.name,
|
101
|
-
(_methodNameSuffix) => (0, import_codegen.renderWithStore)(storeArgument, ({ _typedStore, _store, _commentSuffix, _methodNamePrefix }) => {
|
102
|
-
const externalArguments = (0, import_codegen.renderArguments)([_typedStore, _typedTableId, _typedKeyArgs, _typedFieldName]);
|
103
|
-
const setFieldMethod = field.isDynamic ? "setDynamicField" : "setStaticField";
|
104
|
-
const encodeFieldSingle = renderEncodeFieldSingle(field);
|
105
|
-
const internalArguments = field.isDynamic ? `_tableId, _keyTuple, ${schemaIndex - options.staticFields.length}, ${encodeFieldSingle}` : `_tableId, _keyTuple, ${schemaIndex}, ${encodeFieldSingle}, _fieldLayout`;
|
106
|
-
return `
|
107
|
-
/**
|
108
|
-
* @notice Set ${field.name}${_commentSuffix}.
|
109
|
-
*/
|
110
|
-
function ${_methodNamePrefix}set${_methodNameSuffix}(${externalArguments}) internal {
|
111
|
-
${_keyTupleDefinition}
|
112
|
-
${_store}.${setFieldMethod}(${internalArguments});
|
113
|
-
}
|
114
|
-
`;
|
115
|
-
})
|
116
|
-
);
|
117
|
-
if (field.isDynamic) {
|
118
|
-
const portionData = fieldPortionData(field);
|
119
|
-
const dynamicSchemaIndex = schemaIndex - options.staticFields.length;
|
120
|
-
const { typeWrappingData } = field;
|
121
|
-
if (options.withGetters) {
|
122
|
-
if (typeWrappingData && typeWrappingData.kind === "staticArray") {
|
123
|
-
result += (0, import_codegen.renderWithFieldSuffix)(
|
124
|
-
options.withSuffixlessFieldMethods,
|
125
|
-
field.name,
|
126
|
-
(_methodNameSuffix) => `
|
127
|
-
// The length of ${field.name}
|
128
|
-
uint256 constant length${_methodNameSuffix} = ${typeWrappingData.staticLength};
|
129
|
-
`
|
130
|
-
);
|
131
|
-
} else {
|
132
|
-
result += (0, import_codegen.renderWithFieldSuffix)(
|
133
|
-
options.withSuffixlessFieldMethods,
|
134
|
-
field.name,
|
135
|
-
(_methodNameSuffix) => (0, import_codegen.renderWithStore)(
|
136
|
-
storeArgument,
|
137
|
-
({ _typedStore, _store, _commentSuffix, _methodNamePrefix }) => `
|
138
|
-
/**
|
139
|
-
* @notice Get the length of ${field.name}${_commentSuffix}.
|
140
|
-
*/
|
141
|
-
function ${_methodNamePrefix}length${_methodNameSuffix}(${(0, import_codegen.renderArguments)([
|
142
|
-
_typedStore,
|
143
|
-
_typedTableId,
|
144
|
-
_typedKeyArgs
|
145
|
-
])}) internal view returns (uint256) {
|
146
|
-
${_keyTupleDefinition}
|
147
|
-
uint256 _byteLength = ${_store}.getDynamicFieldLength(_tableId, _keyTuple, ${dynamicSchemaIndex});
|
148
|
-
unchecked {
|
149
|
-
return _byteLength / ${portionData.elementLength};
|
150
|
-
}
|
151
|
-
}
|
152
|
-
`
|
153
|
-
)
|
154
|
-
);
|
155
|
-
}
|
156
|
-
result += (0, import_codegen.renderWithFieldSuffix)(
|
157
|
-
options.withSuffixlessFieldMethods,
|
158
|
-
field.name,
|
159
|
-
(_methodNameSuffix) => (0, import_codegen.renderWithStore)(
|
160
|
-
storeArgument,
|
161
|
-
({ _typedStore, _store, _commentSuffix, _methodNamePrefix }) => `
|
162
|
-
/**
|
163
|
-
* @notice Get an item of ${field.name}${_commentSuffix}.
|
164
|
-
* @dev Reverts with Store_IndexOutOfBounds if \`_index\` is out of bounds for the array.
|
165
|
-
*/
|
166
|
-
function ${_methodNamePrefix}getItem${_methodNameSuffix}(${(0, import_codegen.renderArguments)([
|
167
|
-
_typedStore,
|
168
|
-
_typedTableId,
|
169
|
-
_typedKeyArgs,
|
170
|
-
"uint256 _index"
|
171
|
-
])}) internal view returns (${portionData.typeWithLocation}) {
|
172
|
-
${_keyTupleDefinition}
|
173
|
-
|
174
|
-
${// If the index is within the static length,
|
175
|
-
// but ahead of the dynamic length, return zero
|
176
|
-
typeWrappingData && typeWrappingData.kind === "staticArray" && field.arrayElement ? `
|
177
|
-
uint256 _byteLength = ${_store}.getDynamicFieldLength(_tableId, _keyTuple, ${dynamicSchemaIndex});
|
178
|
-
uint256 dynamicLength = _byteLength / ${portionData.elementLength};
|
179
|
-
uint256 staticLength = ${typeWrappingData.staticLength};
|
180
|
-
|
181
|
-
if (_index < staticLength && _index >= dynamicLength) {
|
182
|
-
return ${renderCastStaticBytesToType(field.arrayElement, `bytes${field.arrayElement.staticByteLength}(new bytes(0))`)};
|
183
|
-
}` : ``}
|
184
|
-
|
185
|
-
unchecked {
|
186
|
-
bytes memory _blob = ${_store}.getDynamicFieldSlice(
|
187
|
-
_tableId,
|
188
|
-
_keyTuple,
|
189
|
-
${dynamicSchemaIndex},
|
190
|
-
_index * ${portionData.elementLength},
|
191
|
-
(_index + 1) * ${portionData.elementLength}
|
192
|
-
);
|
193
|
-
return ${portionData.decoded};
|
194
|
-
}
|
195
|
-
}
|
196
|
-
`
|
197
|
-
)
|
198
|
-
);
|
199
|
-
}
|
200
|
-
if (!typeWrappingData || typeWrappingData.kind !== "staticArray") {
|
201
|
-
result += (0, import_codegen.renderWithFieldSuffix)(
|
202
|
-
options.withSuffixlessFieldMethods,
|
203
|
-
field.name,
|
204
|
-
(_methodNameSuffix) => (0, import_codegen.renderWithStore)(
|
205
|
-
storeArgument,
|
206
|
-
({ _typedStore, _store, _commentSuffix, _methodNamePrefix }) => `
|
207
|
-
/**
|
208
|
-
* @notice Push ${portionData.title} to ${field.name}${_commentSuffix}.
|
209
|
-
*/
|
210
|
-
function ${_methodNamePrefix}push${_methodNameSuffix}(${(0, import_codegen.renderArguments)([
|
211
|
-
_typedStore,
|
212
|
-
_typedTableId,
|
213
|
-
_typedKeyArgs,
|
214
|
-
`${portionData.typeWithLocation} ${portionData.name}`
|
215
|
-
])}) internal {
|
216
|
-
${_keyTupleDefinition}
|
217
|
-
${_store}.pushToDynamicField(_tableId, _keyTuple, ${dynamicSchemaIndex}, ${portionData.encoded});
|
218
|
-
}
|
219
|
-
`
|
220
|
-
)
|
221
|
-
);
|
222
|
-
result += (0, import_codegen.renderWithFieldSuffix)(
|
223
|
-
options.withSuffixlessFieldMethods,
|
224
|
-
field.name,
|
225
|
-
(_methodNameSuffix) => (0, import_codegen.renderWithStore)(
|
226
|
-
storeArgument,
|
227
|
-
({ _typedStore, _store, _commentSuffix, _methodNamePrefix }) => `
|
228
|
-
/**
|
229
|
-
* @notice Pop ${portionData.title} from ${field.name}${_commentSuffix}.
|
230
|
-
*/
|
231
|
-
function ${_methodNamePrefix}pop${_methodNameSuffix}(${(0, import_codegen.renderArguments)([
|
232
|
-
_typedStore,
|
233
|
-
_typedTableId,
|
234
|
-
_typedKeyArgs
|
235
|
-
])}) internal {
|
236
|
-
${_keyTupleDefinition}
|
237
|
-
${_store}.popFromDynamicField(_tableId, _keyTuple, ${dynamicSchemaIndex}, ${portionData.elementLength});
|
238
|
-
}
|
239
|
-
`
|
240
|
-
)
|
241
|
-
);
|
242
|
-
}
|
243
|
-
result += (0, import_codegen.renderWithFieldSuffix)(
|
244
|
-
options.withSuffixlessFieldMethods,
|
245
|
-
field.name,
|
246
|
-
(_methodNameSuffix) => (0, import_codegen.renderWithStore)(storeArgument, ({ _typedStore, _store, _commentSuffix, _methodNamePrefix }) => {
|
247
|
-
const externalArguments = (0, import_codegen.renderArguments)([
|
248
|
-
_typedStore,
|
249
|
-
_typedTableId,
|
250
|
-
_typedKeyArgs,
|
251
|
-
"uint256 _index",
|
252
|
-
`${portionData.typeWithLocation} ${portionData.name}`
|
253
|
-
]);
|
254
|
-
const internalArguments = `
|
255
|
-
_tableId,
|
256
|
-
_keyTuple,
|
257
|
-
${dynamicSchemaIndex},
|
258
|
-
uint40(_index * ${portionData.elementLength}),
|
259
|
-
uint40(_encoded.length),
|
260
|
-
_encoded
|
261
|
-
`;
|
262
|
-
return `
|
263
|
-
/**
|
264
|
-
* @notice Update ${portionData.title} of ${field.name}${_commentSuffix} at \`_index\`.
|
265
|
-
*/
|
266
|
-
function ${_methodNamePrefix}update${_methodNameSuffix}(${externalArguments}) internal {
|
267
|
-
${_keyTupleDefinition}
|
268
|
-
unchecked {
|
269
|
-
bytes memory _encoded = ${portionData.encoded};
|
270
|
-
${_store}.spliceDynamicData(${internalArguments});
|
271
|
-
}
|
272
|
-
}
|
273
|
-
`;
|
274
|
-
})
|
275
|
-
);
|
276
|
-
}
|
277
|
-
}
|
278
|
-
return result;
|
279
|
-
}
|
280
|
-
function renderEncodeFieldSingle(field) {
|
281
|
-
let func;
|
282
|
-
if (field.arrayElement) {
|
283
|
-
func = "EncodeArray.encode";
|
284
|
-
} else if (field.isDynamic) {
|
285
|
-
func = "bytes";
|
286
|
-
} else {
|
287
|
-
func = "abi.encodePacked";
|
288
|
-
}
|
289
|
-
return `${func}(${field.typeUnwrap}(${field.name}))`;
|
290
|
-
}
|
291
|
-
function renderDecodeValueType(field, offset) {
|
292
|
-
const { staticByteLength } = field;
|
293
|
-
const innerSlice = `Bytes.getBytes${staticByteLength}(_blob, ${offset})`;
|
294
|
-
return renderCastStaticBytesToType(field, innerSlice);
|
295
|
-
}
|
296
|
-
function renderCastStaticBytesToType(field, staticBytes) {
|
297
|
-
const { staticByteLength, internalTypeId } = field;
|
298
|
-
const bits = staticByteLength * 8;
|
299
|
-
let result;
|
300
|
-
if (internalTypeId.match(/^uint\d{1,3}$/) || internalTypeId === "address") {
|
301
|
-
result = `${internalTypeId}(${staticBytes})`;
|
302
|
-
} else if (internalTypeId.match(/^int\d{1,3}$/)) {
|
303
|
-
result = `${internalTypeId}(uint${bits}(${staticBytes}))`;
|
304
|
-
} else if (internalTypeId.match(/^bytes\d{1,2}$/)) {
|
305
|
-
result = staticBytes;
|
306
|
-
} else if (internalTypeId === "bool") {
|
307
|
-
result = `_toBool(uint8(${staticBytes}))`;
|
308
|
-
} else {
|
309
|
-
throw new Error(`Unknown value type id ${internalTypeId}`);
|
310
|
-
}
|
311
|
-
return `${field.typeWrap}(${result})`;
|
312
|
-
}
|
313
|
-
function fieldPortionData(field) {
|
314
|
-
if (field.arrayElement) {
|
315
|
-
const name = "_element";
|
316
|
-
const elementFieldData = { ...field.arrayElement, arrayElement: void 0, name };
|
317
|
-
return {
|
318
|
-
typeWithLocation: field.arrayElement.typeWithLocation,
|
319
|
-
name,
|
320
|
-
encoded: renderEncodeFieldSingle(elementFieldData),
|
321
|
-
decoded: renderDecodeFieldSingle(elementFieldData),
|
322
|
-
title: "an element",
|
323
|
-
elementLength: field.arrayElement.staticByteLength
|
324
|
-
};
|
325
|
-
} else {
|
326
|
-
const name = "_slice";
|
327
|
-
const elementFieldData = { ...field, name };
|
328
|
-
return {
|
329
|
-
typeWithLocation: `${field.typeId} memory`,
|
330
|
-
name,
|
331
|
-
encoded: renderEncodeFieldSingle(elementFieldData),
|
332
|
-
decoded: renderDecodeFieldSingle(elementFieldData),
|
333
|
-
title: "a slice",
|
334
|
-
elementLength: 1
|
335
|
-
};
|
336
|
-
}
|
337
|
-
}
|
338
|
-
function renderDecodeFieldSingle(field) {
|
339
|
-
const { isDynamic, arrayElement } = field;
|
340
|
-
if (arrayElement) {
|
341
|
-
return `${field.typeWrap}(
|
342
|
-
SliceLib.getSubslice(_blob, 0, _blob.length).decodeArray_${arrayElement.internalTypeId}()
|
343
|
-
)`;
|
344
|
-
} else if (isDynamic) {
|
345
|
-
return `${field.typeWrap}(${field.internalTypeId}(_blob))`;
|
346
|
-
} else {
|
347
|
-
return renderCastStaticBytesToType(field, `bytes${field.staticByteLength}(_blob)`);
|
348
|
-
}
|
349
|
-
}
|
350
|
-
|
351
|
-
// ts/codegen/record.ts
|
352
|
-
var import_codegen2 = require("@latticexyz/common/codegen");
|
353
|
-
function renderRecordMethods(options) {
|
354
|
-
const { structName, storeArgument } = options;
|
355
|
-
const { _typedTableId, _typedKeyArgs, _keyTupleDefinition } = (0, import_codegen2.renderCommonData)(options);
|
356
|
-
let result = "";
|
357
|
-
if (options.withGetters) {
|
358
|
-
result += (0, import_codegen2.renderWithStore)(
|
359
|
-
storeArgument,
|
360
|
-
({ _typedStore, _store, _commentSuffix, _methodNamePrefix }) => `
|
361
|
-
/**
|
362
|
-
* @notice Get the full data${_commentSuffix}.
|
363
|
-
*/
|
364
|
-
function ${_methodNamePrefix}get(${(0, import_codegen2.renderArguments)([
|
365
|
-
_typedStore,
|
366
|
-
_typedTableId,
|
367
|
-
_typedKeyArgs
|
368
|
-
])}) internal view returns (${renderDecodedRecord(options)}) {
|
369
|
-
${_keyTupleDefinition}
|
370
|
-
|
371
|
-
(
|
372
|
-
bytes memory _staticData,
|
373
|
-
EncodedLengths _encodedLengths,
|
374
|
-
bytes memory _dynamicData
|
375
|
-
) = ${_store}.getRecord(_tableId, _keyTuple, _fieldLayout);
|
376
|
-
return decode(_staticData, _encodedLengths, _dynamicData);
|
377
|
-
}
|
378
|
-
`
|
379
|
-
);
|
380
|
-
}
|
381
|
-
result += (0, import_codegen2.renderWithStore)(
|
382
|
-
storeArgument,
|
383
|
-
({ _typedStore, _store, _commentSuffix, _methodNamePrefix, _useExplicitFieldLayout }) => {
|
384
|
-
const externalArguments = (0, import_codegen2.renderArguments)([
|
385
|
-
_typedStore,
|
386
|
-
_typedTableId,
|
387
|
-
_typedKeyArgs,
|
388
|
-
(0, import_codegen2.renderArguments)(options.fields.map(({ name, typeWithLocation }) => `${typeWithLocation} ${name}`))
|
389
|
-
]);
|
390
|
-
const internalArguments = "_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData" + (_useExplicitFieldLayout ? ", _fieldLayout" : "");
|
391
|
-
return `
|
392
|
-
/**
|
393
|
-
* @notice Set the full data using individual values${_commentSuffix}.
|
394
|
-
*/
|
395
|
-
function ${_methodNamePrefix}set(${externalArguments}) internal {
|
396
|
-
${renderRecordData(options)}
|
397
|
-
|
398
|
-
${_keyTupleDefinition}
|
399
|
-
|
400
|
-
${_store}.setRecord(${internalArguments});
|
401
|
-
}
|
402
|
-
`;
|
403
|
-
}
|
404
|
-
);
|
405
|
-
if (structName !== void 0) {
|
406
|
-
result += (0, import_codegen2.renderWithStore)(
|
407
|
-
storeArgument,
|
408
|
-
({ _typedStore, _store, _commentSuffix, _methodNamePrefix, _useExplicitFieldLayout }) => {
|
409
|
-
const externalArguments = (0, import_codegen2.renderArguments)([
|
410
|
-
_typedStore,
|
411
|
-
_typedTableId,
|
412
|
-
_typedKeyArgs,
|
413
|
-
`${structName} memory _table`
|
414
|
-
]);
|
415
|
-
const internalArguments = "_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData" + (_useExplicitFieldLayout ? ", _fieldLayout" : "");
|
416
|
-
return `
|
417
|
-
/**
|
418
|
-
* @notice Set the full data using the data struct${_commentSuffix}.
|
419
|
-
*/
|
420
|
-
function ${_methodNamePrefix}set(${externalArguments}) internal {
|
421
|
-
${renderRecordData(options, "_table.")}
|
422
|
-
|
423
|
-
${_keyTupleDefinition}
|
424
|
-
|
425
|
-
${_store}.setRecord(${internalArguments});
|
426
|
-
}
|
427
|
-
`;
|
428
|
-
}
|
429
|
-
);
|
430
|
-
}
|
431
|
-
result += renderDecodeFunctions(options);
|
432
|
-
return result;
|
433
|
-
}
|
434
|
-
function renderRecordData(options, namePrefix = "") {
|
435
|
-
let result = "";
|
436
|
-
if (options.staticFields.length > 0) {
|
437
|
-
result += `
|
438
|
-
bytes memory _staticData = encodeStatic(
|
439
|
-
${(0, import_codegen2.renderArguments)(options.staticFields.map(({ name }) => `${namePrefix}${name}`))}
|
440
|
-
);
|
441
|
-
`;
|
442
|
-
} else {
|
443
|
-
result += `bytes memory _staticData;`;
|
444
|
-
}
|
445
|
-
if (options.dynamicFields.length > 0) {
|
446
|
-
result += `
|
447
|
-
EncodedLengths _encodedLengths = encodeLengths(
|
448
|
-
${(0, import_codegen2.renderArguments)(options.dynamicFields.map(({ name }) => `${namePrefix}${name}`))}
|
449
|
-
);
|
450
|
-
bytes memory _dynamicData = encodeDynamic(
|
451
|
-
${(0, import_codegen2.renderArguments)(options.dynamicFields.map(({ name }) => `${namePrefix}${name}`))}
|
452
|
-
);
|
453
|
-
`;
|
454
|
-
} else {
|
455
|
-
result += `
|
456
|
-
EncodedLengths _encodedLengths;
|
457
|
-
bytes memory _dynamicData;
|
458
|
-
`;
|
459
|
-
}
|
460
|
-
return result;
|
461
|
-
}
|
462
|
-
function renderDeleteRecordMethods(options) {
|
463
|
-
const { storeArgument } = options;
|
464
|
-
const { _typedTableId, _typedKeyArgs, _keyTupleDefinition } = (0, import_codegen2.renderCommonData)(options);
|
465
|
-
return (0, import_codegen2.renderWithStore)(
|
466
|
-
storeArgument,
|
467
|
-
({ _typedStore, _store, _commentSuffix, _methodNamePrefix, _useExplicitFieldLayout }) => {
|
468
|
-
const externalArguments = (0, import_codegen2.renderArguments)([_typedStore, _typedTableId, _typedKeyArgs]);
|
469
|
-
const internalArguments = "_tableId, _keyTuple" + (_useExplicitFieldLayout ? ", _fieldLayout" : "");
|
470
|
-
return `
|
471
|
-
/**
|
472
|
-
* @notice Delete all data for given keys${_commentSuffix}.
|
473
|
-
*/
|
474
|
-
function ${_methodNamePrefix}deleteRecord(${externalArguments}) internal {
|
475
|
-
${_keyTupleDefinition}
|
476
|
-
${_store}.deleteRecord(${internalArguments});
|
477
|
-
}
|
478
|
-
`;
|
479
|
-
}
|
480
|
-
);
|
481
|
-
}
|
482
|
-
function renderDecodeFunctions({ structName, fields, staticFields, dynamicFields }) {
|
483
|
-
const renderedDecodedRecord = structName ? `${structName} memory _table` : (0, import_codegen2.renderArguments)(fields.map(({ name, typeWithLocation }) => `${typeWithLocation} ${name}`));
|
484
|
-
const fieldNamePrefix = structName ? "_table." : "";
|
485
|
-
const staticOffsets = staticFields.map(() => 0);
|
486
|
-
let _acc = 0;
|
487
|
-
for (const [index, field] of staticFields.entries()) {
|
488
|
-
staticOffsets[index] = _acc;
|
489
|
-
_acc += field.staticByteLength;
|
490
|
-
}
|
491
|
-
let result = "";
|
492
|
-
if (staticFields.length > 0) {
|
493
|
-
result += `
|
494
|
-
/**
|
495
|
-
* @notice Decode the tightly packed blob of static data using this table's field layout.
|
496
|
-
*/
|
497
|
-
function decodeStatic(bytes memory _blob) internal pure returns (${(0, import_codegen2.renderArguments)(
|
498
|
-
staticFields.map(({ name, typeWithLocation }) => `${typeWithLocation} ${name}`)
|
499
|
-
)}) {
|
500
|
-
${(0, import_codegen2.renderList)(
|
501
|
-
staticFields,
|
502
|
-
(field, index) => `
|
503
|
-
${field.name} = ${renderDecodeValueType(field, staticOffsets[index])};
|
504
|
-
`
|
505
|
-
)}
|
506
|
-
}
|
507
|
-
`;
|
508
|
-
}
|
509
|
-
if (dynamicFields.length > 0) {
|
510
|
-
result += `
|
511
|
-
/**
|
512
|
-
* @notice Decode the tightly packed blob of dynamic data using the encoded lengths.
|
513
|
-
*/
|
514
|
-
function decodeDynamic(EncodedLengths _encodedLengths, bytes memory _blob) internal pure returns (${(0, import_codegen2.renderArguments)(
|
515
|
-
dynamicFields.map(({ name, typeWithLocation }) => `${typeWithLocation} ${name}`)
|
516
|
-
)}) {
|
517
|
-
${(0, import_codegen2.renderList)(
|
518
|
-
dynamicFields,
|
519
|
-
// unchecked is only dangerous if _encodedLengths (and _blob) is invalid,
|
520
|
-
// but it's assumed to be valid, and this function is meant to be mostly used internally
|
521
|
-
(field, index) => {
|
522
|
-
if (index === 0) {
|
523
|
-
return `
|
524
|
-
uint256 _start;
|
525
|
-
uint256 _end;
|
526
|
-
unchecked {
|
527
|
-
_end = _encodedLengths.atIndex(${index});
|
528
|
-
}
|
529
|
-
${field.name} = ${renderDecodeDynamicFieldPartial(field)};
|
530
|
-
`;
|
531
|
-
} else {
|
532
|
-
return `
|
533
|
-
_start = _end;
|
534
|
-
unchecked {
|
535
|
-
_end += _encodedLengths.atIndex(${index});
|
536
|
-
}
|
537
|
-
${field.name} = ${renderDecodeDynamicFieldPartial(field)};
|
538
|
-
`;
|
539
|
-
}
|
540
|
-
}
|
541
|
-
)}
|
542
|
-
}
|
543
|
-
`;
|
544
|
-
}
|
545
|
-
result += `
|
546
|
-
/**
|
547
|
-
* @notice Decode the tightly packed blobs using this table's field layout.
|
548
|
-
* ${staticFields.length > 0 ? "@param _staticData Tightly packed static fields." : ""}
|
549
|
-
* ${dynamicFields.length > 0 ? "@param _encodedLengths Encoded lengths of dynamic fields." : ""}
|
550
|
-
* ${dynamicFields.length > 0 ? "@param _dynamicData Tightly packed dynamic fields." : ""}
|
551
|
-
*/
|
552
|
-
function decode(
|
553
|
-
bytes memory ${staticFields.length > 0 ? "_staticData" : ""},
|
554
|
-
EncodedLengths ${dynamicFields.length > 0 ? "_encodedLengths" : ""},
|
555
|
-
bytes memory ${dynamicFields.length > 0 ? "_dynamicData" : ""}
|
556
|
-
) internal pure returns (${renderedDecodedRecord}) {
|
557
|
-
`;
|
558
|
-
if (staticFields.length > 0) {
|
559
|
-
result += `
|
560
|
-
(${(0, import_codegen2.renderArguments)(staticFields.map((field) => `${fieldNamePrefix}${field.name}`))}) = decodeStatic(_staticData);
|
561
|
-
`;
|
562
|
-
}
|
563
|
-
if (dynamicFields.length > 0) {
|
564
|
-
result += `
|
565
|
-
(${(0, import_codegen2.renderArguments)(
|
566
|
-
dynamicFields.map((field) => `${fieldNamePrefix}${field.name}`)
|
567
|
-
)}) = decodeDynamic(_encodedLengths, _dynamicData);
|
568
|
-
`;
|
569
|
-
}
|
570
|
-
result += `
|
571
|
-
}
|
572
|
-
`;
|
573
|
-
return result;
|
574
|
-
}
|
575
|
-
function renderDecodedRecord({ structName, fields }) {
|
576
|
-
if (structName) {
|
577
|
-
return `${structName} memory _table`;
|
578
|
-
} else {
|
579
|
-
return (0, import_codegen2.renderArguments)(fields.map(({ name, typeWithLocation }) => `${typeWithLocation} ${name}`));
|
580
|
-
}
|
581
|
-
}
|
582
|
-
function renderDecodeDynamicFieldPartial(field) {
|
583
|
-
const { typeId, arrayElement, typeWrap } = field;
|
584
|
-
if (arrayElement) {
|
585
|
-
return `${typeWrap}(
|
586
|
-
SliceLib.getSubslice(_blob, _start, _end).decodeArray_${arrayElement.typeId}()
|
587
|
-
)`;
|
588
|
-
} else {
|
589
|
-
return `${typeWrap}(
|
590
|
-
${typeId}(
|
591
|
-
SliceLib.getSubslice(_blob, _start, _end).toBytes()
|
592
|
-
)
|
593
|
-
)`;
|
594
|
-
}
|
595
|
-
}
|
596
|
-
|
597
|
-
// ts/codegen/renderTable.ts
|
598
|
-
var import_codegen3 = require("@latticexyz/common/codegen");
|
599
|
-
|
600
|
-
// ts/constants.ts
|
601
|
-
var WORD_SIZE = 32;
|
602
|
-
var WORD_LAST_INDEX = 31;
|
603
|
-
var BYTE_TO_BITS = 8;
|
604
|
-
var MAX_TOTAL_FIELDS = 28;
|
605
|
-
var MAX_DYNAMIC_FIELDS = 5;
|
606
|
-
var LayoutOffsets = {
|
607
|
-
TOTAL_LENGTH: (WORD_SIZE - 2) * BYTE_TO_BITS,
|
608
|
-
NUM_STATIC_FIELDS: (WORD_SIZE - 2 - 1) * BYTE_TO_BITS,
|
609
|
-
NUM_DYNAMIC_FIELDS: (WORD_SIZE - 2 - 1 - 1) * BYTE_TO_BITS
|
610
|
-
};
|
611
|
-
|
612
|
-
// ts/codegen/renderFieldLayout.ts
|
613
|
-
function renderFieldLayout(fields) {
|
614
|
-
return `FieldLayout constant _fieldLayout = FieldLayout.wrap(${encodeFieldLayout(fields)});`;
|
615
|
-
}
|
616
|
-
function encodeFieldLayout(fields) {
|
617
|
-
const staticFields = fields.filter(({ isDynamic }) => !isDynamic);
|
618
|
-
const numDynamicFields = fields.length - staticFields.length;
|
619
|
-
let fieldLayout = 0n;
|
620
|
-
let totalLength = 0;
|
621
|
-
const totalFields = fields.length;
|
622
|
-
if (totalFields > MAX_TOTAL_FIELDS) throw new Error("FieldLayout: too many fields");
|
623
|
-
if (numDynamicFields > MAX_DYNAMIC_FIELDS) throw new Error("FieldLayout: too many dynamic fields");
|
624
|
-
for (let i = 0; i < staticFields.length; i++) {
|
625
|
-
const { isDynamic, staticByteLength } = fields[i];
|
626
|
-
if (isDynamic) throw new Error(`FieldLayout: static type after dynamic type`);
|
627
|
-
totalLength += staticByteLength;
|
628
|
-
fieldLayout |= BigInt(staticByteLength) << BigInt((WORD_LAST_INDEX - 4 - i) * BYTE_TO_BITS);
|
629
|
-
}
|
630
|
-
fieldLayout |= BigInt(totalLength) << BigInt(LayoutOffsets.TOTAL_LENGTH);
|
631
|
-
fieldLayout |= BigInt(staticFields.length) << BigInt(LayoutOffsets.NUM_STATIC_FIELDS);
|
632
|
-
fieldLayout |= BigInt(numDynamicFields) << BigInt(LayoutOffsets.NUM_DYNAMIC_FIELDS);
|
633
|
-
return `0x${fieldLayout.toString(16).padStart(64, "0")}`;
|
634
|
-
}
|
635
|
-
|
636
|
-
// ts/codegen/renderTable.ts
|
637
|
-
var import_internal = require("@latticexyz/protocol-parser/internal");
|
638
|
-
function renderTable(options) {
|
639
|
-
const {
|
640
|
-
imports,
|
641
|
-
libraryName,
|
642
|
-
structName,
|
643
|
-
staticResourceData,
|
644
|
-
storeImportPath,
|
645
|
-
fields,
|
646
|
-
staticFields,
|
647
|
-
dynamicFields,
|
648
|
-
withRecordMethods,
|
649
|
-
storeArgument,
|
650
|
-
keyTuple
|
651
|
-
} = options;
|
652
|
-
const { _typedTableId, _typedKeyArgs, _keyTupleDefinition } = (0, import_codegen3.renderCommonData)(options);
|
653
|
-
return `
|
654
|
-
${import_codegen3.renderedSolidityHeader}
|
655
|
-
|
656
|
-
// Import store internals
|
657
|
-
import { IStore } from "${(0, import_codegen3.renderImportPath)(storeImportPath, "IStore.sol")}";
|
658
|
-
import { StoreSwitch } from "${(0, import_codegen3.renderImportPath)(storeImportPath, "StoreSwitch.sol")}";
|
659
|
-
import { StoreCore } from "${(0, import_codegen3.renderImportPath)(storeImportPath, "StoreCore.sol")}";
|
660
|
-
import { Bytes } from "${(0, import_codegen3.renderImportPath)(storeImportPath, "Bytes.sol")}";
|
661
|
-
import { Memory } from "${(0, import_codegen3.renderImportPath)(storeImportPath, "Memory.sol")}";
|
662
|
-
import { SliceLib } from "${(0, import_codegen3.renderImportPath)(storeImportPath, "Slice.sol")}";
|
663
|
-
import { EncodeArray } from "${(0, import_codegen3.renderImportPath)(storeImportPath, "tightcoder/EncodeArray.sol")}";
|
664
|
-
import { FieldLayout } from "${(0, import_codegen3.renderImportPath)(storeImportPath, "FieldLayout.sol")}";
|
665
|
-
import { Schema } from "${(0, import_codegen3.renderImportPath)(storeImportPath, "Schema.sol")}";
|
666
|
-
import { EncodedLengths, EncodedLengthsLib } from "${(0, import_codegen3.renderImportPath)(storeImportPath, "EncodedLengths.sol")}";
|
667
|
-
import { ResourceId } from "${(0, import_codegen3.renderImportPath)(storeImportPath, "ResourceId.sol")}";
|
668
|
-
|
669
|
-
${imports.length > 0 ? `
|
670
|
-
// Import user types
|
671
|
-
${(0, import_codegen3.renderImports)(imports)}
|
672
|
-
` : ""}
|
673
|
-
|
674
|
-
${!structName ? "" : `
|
675
|
-
struct ${structName} {
|
676
|
-
${(0, import_codegen3.renderList)(fields, ({ name, typeId }) => `${typeId} ${name};`)}
|
677
|
-
}
|
678
|
-
`}
|
679
|
-
|
680
|
-
library ${libraryName} {
|
681
|
-
${staticResourceData ? (0, import_codegen3.renderTableId)(staticResourceData) : ""}
|
682
|
-
|
683
|
-
${renderFieldLayout(fields)}
|
684
|
-
|
685
|
-
// Hex-encoded key schema of (${keyTuple.map((field) => field.internalTypeId).join(", ")})
|
686
|
-
Schema constant _keySchema = Schema.wrap(${(0, import_internal.keySchemaToHex)(
|
687
|
-
Object.fromEntries(keyTuple.map((field) => [field.name, field.internalTypeId]))
|
688
|
-
)});
|
689
|
-
// Hex-encoded value schema of (${fields.map((field) => field.internalTypeId).join(", ")})
|
690
|
-
Schema constant _valueSchema = Schema.wrap(${(0, import_internal.valueSchemaToHex)(
|
691
|
-
Object.fromEntries(fields.map((field) => [field.name, field.internalTypeId]))
|
692
|
-
)});
|
693
|
-
|
694
|
-
/**
|
695
|
-
* @notice Get the table's key field names.
|
696
|
-
* @return keyNames An array of strings with the names of key fields.
|
697
|
-
*/
|
698
|
-
function getKeyNames() internal pure returns (string[] memory keyNames) {
|
699
|
-
keyNames = new string[](${keyTuple.length});
|
700
|
-
${(0, import_codegen3.renderList)(keyTuple, (keyElement, index) => `keyNames[${index}] = "${keyElement.name}";`)}
|
701
|
-
}
|
702
|
-
|
703
|
-
/**
|
704
|
-
* @notice Get the table's value field names.
|
705
|
-
* @return fieldNames An array of strings with the names of value fields.
|
706
|
-
*/
|
707
|
-
function getFieldNames() internal pure returns (string[] memory fieldNames) {
|
708
|
-
fieldNames = new string[](${fields.length});
|
709
|
-
${(0, import_codegen3.renderList)(fields, (field, index) => `fieldNames[${index}] = "${field.name}";`)}
|
710
|
-
}
|
711
|
-
|
712
|
-
${(0, import_codegen3.renderWithStore)(
|
713
|
-
storeArgument,
|
714
|
-
({ _typedStore, _store, _commentSuffix, _methodNamePrefix }) => `
|
715
|
-
/**
|
716
|
-
* @notice Register the table with its config${_commentSuffix}.
|
717
|
-
*/
|
718
|
-
function ${_methodNamePrefix}register(${(0, import_codegen3.renderArguments)([_typedStore, _typedTableId])}) internal {
|
719
|
-
${_store}.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames());
|
720
|
-
}
|
721
|
-
`
|
722
|
-
)}
|
723
|
-
|
724
|
-
${renderFieldMethods(options)}
|
725
|
-
|
726
|
-
${withRecordMethods ? renderRecordMethods(options) : ""}
|
727
|
-
|
728
|
-
${renderDeleteRecordMethods(options)}
|
729
|
-
|
730
|
-
${renderEncodeStatic(staticFields)}
|
731
|
-
|
732
|
-
${renderEncodeLengths(dynamicFields)}
|
733
|
-
|
734
|
-
${renderEncodeDynamic(dynamicFields)}
|
735
|
-
|
736
|
-
/**
|
737
|
-
* @notice Encode all of a record's fields.
|
738
|
-
* @return The static (fixed length) data, encoded into a sequence of bytes.
|
739
|
-
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
740
|
-
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
741
|
-
*/
|
742
|
-
function encode(${(0, import_codegen3.renderArguments)(
|
743
|
-
options.fields.map(({ name, typeWithLocation }) => `${typeWithLocation} ${name}`)
|
744
|
-
)}) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
745
|
-
${renderRecordData(options)}
|
746
|
-
|
747
|
-
return (_staticData, _encodedLengths, _dynamicData);
|
748
|
-
}
|
749
|
-
|
750
|
-
/**
|
751
|
-
* @notice Encode keys as a bytes32 array using this table's field layout.
|
752
|
-
*/
|
753
|
-
function encodeKeyTuple(${(0, import_codegen3.renderArguments)([_typedKeyArgs])}) internal pure returns (bytes32[] memory) {
|
754
|
-
${_keyTupleDefinition}
|
755
|
-
return _keyTuple;
|
756
|
-
}
|
757
|
-
}
|
758
|
-
|
759
|
-
${(0, import_codegen3.renderTypeHelpers)(options)}
|
760
|
-
`;
|
761
|
-
}
|
762
|
-
function renderEncodeStatic(staticFields) {
|
763
|
-
if (staticFields.length === 0) return "";
|
764
|
-
return `
|
765
|
-
/**
|
766
|
-
* @notice Tightly pack static (fixed length) data using this table's schema.
|
767
|
-
* @return The static data, encoded into a sequence of bytes.
|
768
|
-
*/
|
769
|
-
function encodeStatic(${(0, import_codegen3.renderArguments)(
|
770
|
-
staticFields.map(({ name, typeWithLocation }) => `${typeWithLocation} ${name}`)
|
771
|
-
)}) internal pure returns (bytes memory) {
|
772
|
-
return abi.encodePacked(${(0, import_codegen3.renderArguments)(staticFields.map(({ name }) => name))});
|
773
|
-
}
|
774
|
-
`;
|
775
|
-
}
|
776
|
-
function renderEncodeLengths(dynamicFields) {
|
777
|
-
if (dynamicFields.length === 0) return "";
|
778
|
-
return `
|
779
|
-
/**
|
780
|
-
* @notice Tightly pack dynamic data lengths using this table's schema.
|
781
|
-
* @return _encodedLengths The lengths of the dynamic fields (packed into a single bytes32 value).
|
782
|
-
*/
|
783
|
-
function encodeLengths(${(0, import_codegen3.renderArguments)(
|
784
|
-
dynamicFields.map(({ name, typeWithLocation }) => `${typeWithLocation} ${name}`)
|
785
|
-
)}) internal pure returns (EncodedLengths _encodedLengths) {
|
786
|
-
// Lengths are effectively checked during copy by 2**40 bytes exceeding gas limits
|
787
|
-
unchecked {
|
788
|
-
_encodedLengths = EncodedLengthsLib.pack(
|
789
|
-
${(0, import_codegen3.renderArguments)(
|
790
|
-
dynamicFields.map(({ name, arrayElement }) => {
|
791
|
-
if (arrayElement) {
|
792
|
-
return `${name}.length * ${arrayElement.staticByteLength}`;
|
793
|
-
} else {
|
794
|
-
return `bytes(${name}).length`;
|
795
|
-
}
|
796
|
-
})
|
797
|
-
)}
|
798
|
-
);
|
799
|
-
}
|
800
|
-
}
|
801
|
-
`;
|
802
|
-
}
|
803
|
-
function renderEncodeDynamic(dynamicFields) {
|
804
|
-
if (dynamicFields.length === 0) return "";
|
805
|
-
return `
|
806
|
-
/**
|
807
|
-
* @notice Tightly pack dynamic (variable length) data using this table's schema.
|
808
|
-
* @return The dynamic data, encoded into a sequence of bytes.
|
809
|
-
*/
|
810
|
-
function encodeDynamic(${(0, import_codegen3.renderArguments)(
|
811
|
-
dynamicFields.map(({ name, typeWithLocation }) => `${typeWithLocation} ${name}`)
|
812
|
-
)}) internal pure returns (bytes memory) {
|
813
|
-
return abi.encodePacked(${(0, import_codegen3.renderArguments)(dynamicFields.map((field) => renderEncodeFieldSingle(field)))});
|
814
|
-
}
|
815
|
-
`;
|
816
|
-
}
|
817
|
-
|
818
|
-
// ts/codegen/renderTypesFromConfig.ts
|
819
|
-
var import_codegen4 = require("@latticexyz/common/codegen");
|
820
|
-
function renderTypesFromConfig(config) {
|
821
|
-
return (0, import_codegen4.renderEnums)(config.enums);
|
822
|
-
}
|
823
|
-
|
824
|
-
// ts/codegen/tablegen.ts
|
825
|
-
var import_promises = __toESM(require("fs/promises"), 1);
|
826
|
-
var import_node_path3 = __toESM(require("path"), 1);
|
827
|
-
var import_codegen6 = require("@latticexyz/common/codegen");
|
828
|
-
|
829
|
-
// ts/codegen/renderTableIndex.ts
|
830
|
-
var import_codegen5 = require("@latticexyz/common/codegen");
|
831
|
-
var import_node_path = __toESM(require("path"), 1);
|
832
|
-
function renderTableIndex(codegenIndexPath, options) {
|
833
|
-
return `
|
834
|
-
${import_codegen5.renderedSolidityHeader}
|
835
|
-
|
836
|
-
${(0, import_codegen5.renderList)(options, ({ outputPath, tableName, renderOptions: { structName } }) => {
|
837
|
-
const imports = [tableName];
|
838
|
-
if (structName) imports.push(structName);
|
839
|
-
return `import { ${imports.join(", ")} } from "${(0, import_codegen5.renderImportPath)("./" + import_node_path.default.relative(import_node_path.default.dirname(codegenIndexPath), outputPath))}";`;
|
840
|
-
})}
|
841
|
-
`;
|
842
|
-
}
|
843
|
-
|
844
|
-
// ts/codegen/tablegen.ts
|
845
|
-
var import_utils3 = require("@latticexyz/common/utils");
|
846
|
-
|
847
|
-
// ts/codegen/getUserTypesFilename.ts
|
848
|
-
var import_node_path2 = __toESM(require("path"), 1);
|
849
|
-
function getUserTypesFilename({ config }) {
|
850
|
-
return import_node_path2.default.join(config.sourceDirectory, config.codegen.outputDirectory, config.codegen.userTypesFilename);
|
851
|
-
}
|
852
|
-
|
853
|
-
// ts/codegen/getUserTypes.ts
|
854
|
-
var import_utils = require("@latticexyz/common/utils");
|
855
|
-
function getUserTypes({ config }) {
|
856
|
-
const enums = Object.keys(config.enums).map(
|
857
|
-
(name) => ({
|
858
|
-
type: "enum",
|
859
|
-
name,
|
860
|
-
abiType: "uint8",
|
861
|
-
importPath: "./" + getUserTypesFilename({ config })
|
862
|
-
})
|
863
|
-
);
|
864
|
-
const userTypes = Object.entries(config.userTypes).map(
|
865
|
-
([name, userType]) => ({
|
866
|
-
type: "userType",
|
867
|
-
name,
|
868
|
-
abiType: userType.type,
|
869
|
-
// If `userType.filePath` starts with a `.`, it's relative to the root dir
|
870
|
-
importPath: userType.filePath
|
871
|
-
})
|
872
|
-
);
|
873
|
-
const result = [...enums, ...userTypes];
|
874
|
-
const duplicates = Array.from((0, import_utils.groupBy)(result, (userType) => userType.name).entries()).filter(([, entries]) => entries.length > 1).map(([name]) => name);
|
875
|
-
if (duplicates.length > 0) {
|
876
|
-
throw new Error(`Found enums and user types sharing the same name: ${duplicates.join(", ")}`);
|
877
|
-
}
|
878
|
-
return result;
|
879
|
-
}
|
880
|
-
|
881
|
-
// ts/codegen/getTableOptions.ts
|
882
|
-
var import_path = __toESM(require("path"), 1);
|
883
|
-
var import_deprecated2 = require("@latticexyz/schema-type/deprecated");
|
884
|
-
|
885
|
-
// ts/codegen/userType.ts
|
886
|
-
var import_deprecated = require("@latticexyz/schema-type/deprecated");
|
887
|
-
function parseStaticArray(abiType) {
|
888
|
-
const matches = abiType.match(/^(\w+)\[(\d+)\]$/);
|
889
|
-
if (!matches) return null;
|
890
|
-
return {
|
891
|
-
elementType: matches[1],
|
892
|
-
staticLength: Number.parseInt(matches[2])
|
893
|
-
};
|
894
|
-
}
|
895
|
-
function resolveAbiOrUserType(abiOrUserType, userTypes) {
|
896
|
-
if (abiOrUserType in import_deprecated.AbiTypeToSchemaType) {
|
897
|
-
const schemaType = import_deprecated.AbiTypeToSchemaType[abiOrUserType];
|
898
|
-
return {
|
899
|
-
schemaType,
|
900
|
-
renderType: getSchemaTypeInfo(schemaType)
|
901
|
-
};
|
902
|
-
}
|
903
|
-
const staticArray = parseStaticArray(abiOrUserType);
|
904
|
-
if (staticArray) {
|
905
|
-
if (staticArray.elementType in import_deprecated.AbiTypeToSchemaType) {
|
906
|
-
return getStaticArrayTypeInfo(abiOrUserType, staticArray.elementType, staticArray.staticLength);
|
907
|
-
} else {
|
908
|
-
throw new Error("Static arrays of user types are not supported");
|
909
|
-
}
|
910
|
-
}
|
911
|
-
const userType = userTypes.find((type) => type.name === abiOrUserType);
|
912
|
-
if (!userType) {
|
913
|
-
throw new Error(`User type "${abiOrUserType}" not found`);
|
914
|
-
}
|
915
|
-
return getUserTypeInfo(userType);
|
916
|
-
}
|
917
|
-
function getSchemaTypeInfo(schemaType) {
|
918
|
-
const staticByteLength = (0, import_deprecated.getStaticByteLength)(schemaType);
|
919
|
-
const isDynamic = staticByteLength === 0;
|
920
|
-
const typeId = import_deprecated.SchemaTypeToAbiType[schemaType];
|
921
|
-
return {
|
922
|
-
typeId,
|
923
|
-
typeWithLocation: isDynamic ? typeId + " memory" : typeId,
|
924
|
-
enumName: import_deprecated.SchemaType[schemaType],
|
925
|
-
staticByteLength,
|
926
|
-
isDynamic,
|
927
|
-
typeWrap: "",
|
928
|
-
typeUnwrap: "",
|
929
|
-
internalTypeId: typeId
|
930
|
-
};
|
931
|
-
}
|
932
|
-
function getUserTypeInfo(userType) {
|
933
|
-
switch (userType.type) {
|
934
|
-
case "enum": {
|
935
|
-
const schemaType = import_deprecated.SchemaType.UINT8;
|
936
|
-
const staticByteLength = (0, import_deprecated.getStaticByteLength)(schemaType);
|
937
|
-
const isDynamic = staticByteLength === 0;
|
938
|
-
return {
|
939
|
-
schemaType,
|
940
|
-
renderType: {
|
941
|
-
typeId: userType.name,
|
942
|
-
typeWithLocation: userType.name,
|
943
|
-
enumName: import_deprecated.SchemaType[schemaType],
|
944
|
-
staticByteLength,
|
945
|
-
isDynamic,
|
946
|
-
typeWrap: userType.name,
|
947
|
-
typeUnwrap: userType.abiType,
|
948
|
-
internalTypeId: userType.abiType
|
949
|
-
}
|
950
|
-
};
|
951
|
-
}
|
952
|
-
case "userType": {
|
953
|
-
const schemaType = import_deprecated.AbiTypeToSchemaType[userType.abiType];
|
954
|
-
return {
|
955
|
-
schemaType,
|
956
|
-
renderType: {
|
957
|
-
typeId: userType.name,
|
958
|
-
typeWithLocation: userType.name,
|
959
|
-
enumName: import_deprecated.SchemaType[schemaType],
|
960
|
-
staticByteLength: (0, import_deprecated.getStaticByteLength)(schemaType),
|
961
|
-
isDynamic: false,
|
962
|
-
typeWrap: `${userType.name}.wrap`,
|
963
|
-
typeUnwrap: `${userType.name}.unwrap`,
|
964
|
-
internalTypeId: userType.abiType
|
965
|
-
}
|
966
|
-
};
|
967
|
-
}
|
968
|
-
}
|
969
|
-
}
|
970
|
-
function getStaticArrayTypeInfo(abiType, elementType, staticLength) {
|
971
|
-
const internalTypeId = elementType + "[]";
|
972
|
-
const schemaType = import_deprecated.AbiTypeToSchemaType[internalTypeId];
|
973
|
-
return {
|
974
|
-
schemaType,
|
975
|
-
renderType: {
|
976
|
-
typeId: abiType,
|
977
|
-
typeWithLocation: `${abiType} memory`,
|
978
|
-
enumName: import_deprecated.SchemaType[schemaType],
|
979
|
-
staticByteLength: 0,
|
980
|
-
isDynamic: true,
|
981
|
-
typeWrap: `toStaticArray_${elementType}_${staticLength}`,
|
982
|
-
typeUnwrap: `fromStaticArray_${elementType}_${staticLength}`,
|
983
|
-
typeWrappingData: {
|
984
|
-
kind: "staticArray",
|
985
|
-
elementType,
|
986
|
-
staticLength
|
987
|
-
},
|
988
|
-
internalTypeId
|
989
|
-
}
|
990
|
-
};
|
991
|
-
}
|
992
|
-
|
993
|
-
// ts/codegen/getTableOptions.ts
|
994
|
-
var import_internal2 = require("@latticexyz/protocol-parser/internal");
|
995
|
-
var import_utils2 = require("@latticexyz/common/utils");
|
996
|
-
function getTableOptions({
|
997
|
-
tables,
|
998
|
-
rootDir,
|
999
|
-
codegenDir,
|
1000
|
-
userTypes,
|
1001
|
-
storeImportPath
|
1002
|
-
}) {
|
1003
|
-
const options = tables.map((table) => {
|
1004
|
-
const outputPath = import_path.default.join(rootDir, codegenDir, table.codegen.outputDirectory, `${table.label}.sol`);
|
1005
|
-
const keySchema = (0, import_internal2.getKeySchema)(table);
|
1006
|
-
const valueSchema = (0, import_internal2.getValueSchema)(table);
|
1007
|
-
const withStruct = table.codegen.dataStruct;
|
1008
|
-
const withRecordMethods = withStruct || table.type === "offchainTable" || Object.keys(valueSchema).length > 1;
|
1009
|
-
const withSuffixlessFieldMethods = !withRecordMethods && Object.keys(valueSchema).length === 1;
|
1010
|
-
const imports = Object.values(table.schema).map((field) => userTypes.find((type) => type.name === field.internalType)).filter(import_utils2.isDefined).map((userType) => {
|
1011
|
-
return {
|
1012
|
-
// If it's a fully qualified name, remove trailing references
|
1013
|
-
// This enables support for user types inside libraries
|
1014
|
-
symbol: userType.name.replace(/\..*$/, ""),
|
1015
|
-
path: userType.importPath.startsWith(".") ? "./" + import_path.default.relative(import_path.default.dirname(outputPath), import_path.default.join(rootDir, userType.importPath)) : userType.importPath
|
1016
|
-
};
|
1017
|
-
});
|
1018
|
-
const keyTuple = Object.entries(keySchema).map(([name, field]) => {
|
1019
|
-
const { renderType } = resolveAbiOrUserType(field.internalType, userTypes);
|
1020
|
-
return {
|
1021
|
-
...renderType,
|
1022
|
-
name,
|
1023
|
-
isDynamic: false
|
1024
|
-
};
|
1025
|
-
});
|
1026
|
-
const fields = Object.entries(valueSchema).map(([name, field]) => {
|
1027
|
-
const { renderType, schemaType } = resolveAbiOrUserType(field.internalType, userTypes);
|
1028
|
-
const elementType = import_deprecated2.SchemaTypeArrayToElement[schemaType];
|
1029
|
-
return {
|
1030
|
-
...renderType,
|
1031
|
-
arrayElement: elementType !== void 0 ? getSchemaTypeInfo(elementType) : void 0,
|
1032
|
-
name
|
1033
|
-
};
|
1034
|
-
});
|
1035
|
-
const staticFields = fields.filter(({ isDynamic }) => !isDynamic);
|
1036
|
-
const dynamicFields = fields.filter(({ isDynamic }) => isDynamic);
|
1037
|
-
const staticResourceData = table.codegen.tableIdArgument ? void 0 : {
|
1038
|
-
namespace: table.namespace,
|
1039
|
-
name: table.name,
|
1040
|
-
offchainOnly: table.type === "offchainTable"
|
1041
|
-
};
|
1042
|
-
return {
|
1043
|
-
outputPath,
|
1044
|
-
tableName: table.label,
|
1045
|
-
renderOptions: {
|
1046
|
-
imports,
|
1047
|
-
libraryName: table.label,
|
1048
|
-
structName: withStruct ? table.label + "Data" : void 0,
|
1049
|
-
staticResourceData,
|
1050
|
-
storeImportPath: storeImportPath.startsWith(".") ? "./" + import_path.default.relative(import_path.default.dirname(outputPath), import_path.default.join(rootDir, storeImportPath)) : storeImportPath,
|
1051
|
-
keyTuple,
|
1052
|
-
fields,
|
1053
|
-
staticFields,
|
1054
|
-
dynamicFields,
|
1055
|
-
withGetters: table.type === "table",
|
1056
|
-
withRecordMethods,
|
1057
|
-
withDynamicFieldMethods: table.type === "table",
|
1058
|
-
withSuffixlessFieldMethods,
|
1059
|
-
storeArgument: table.codegen.storeArgument
|
1060
|
-
}
|
1061
|
-
};
|
1062
|
-
});
|
1063
|
-
return options;
|
1064
|
-
}
|
1065
|
-
|
1066
|
-
// ts/codegen/tablegen.ts
|
1067
|
-
var import_debug = __toESM(require("debug"), 1);
|
1068
|
-
async function tablegen({ rootDir, config }) {
|
1069
|
-
const userTypes = getUserTypes({ config });
|
1070
|
-
if (Object.keys(config.enums).length > 0) {
|
1071
|
-
const userTypesFilename = import_node_path3.default.join(rootDir, getUserTypesFilename({ config }));
|
1072
|
-
const source = (0, import_codegen6.renderEnums)(config.enums);
|
1073
|
-
await (0, import_codegen6.formatAndWriteSolidity)(source, userTypesFilename, "Generated types file with enums");
|
1074
|
-
}
|
1075
|
-
await Promise.all(
|
1076
|
-
Object.values(config.namespaces).map(async (namespace) => {
|
1077
|
-
const sourceDir = config.multipleNamespaces ? import_node_path3.default.join(config.sourceDirectory, "namespaces", namespace.label) : config.sourceDirectory;
|
1078
|
-
const codegenDir = import_node_path3.default.join(sourceDir, config.codegen.outputDirectory);
|
1079
|
-
const tables = Object.values(namespace.tables);
|
1080
|
-
if (tables.length === 0) return;
|
1081
|
-
const tableOptions = getTableOptions({
|
1082
|
-
tables,
|
1083
|
-
rootDir,
|
1084
|
-
codegenDir,
|
1085
|
-
userTypes,
|
1086
|
-
storeImportPath: config.codegen.storeImportPath
|
1087
|
-
});
|
1088
|
-
const tableDirs = (0, import_utils3.uniqueBy)(
|
1089
|
-
tableOptions.map(({ outputPath }) => import_node_path3.default.dirname(outputPath)),
|
1090
|
-
(dir) => dir
|
1091
|
-
);
|
1092
|
-
await Promise.all(tableDirs.map((dir) => import_promises.default.rm(dir, { recursive: true, force: true })));
|
1093
|
-
await Promise.all(
|
1094
|
-
tableOptions.map(async ({ outputPath, renderOptions }) => {
|
1095
|
-
const source = renderTable(renderOptions);
|
1096
|
-
return await (0, import_codegen6.formatAndWriteSolidity)(source, outputPath, "Generated table");
|
1097
|
-
})
|
1098
|
-
);
|
1099
|
-
if (config.codegen.indexFilename !== false && tableOptions.length > 0) {
|
1100
|
-
const codegenIndexPath = import_node_path3.default.join(rootDir, codegenDir, config.codegen.indexFilename);
|
1101
|
-
const source = renderTableIndex(codegenIndexPath, tableOptions);
|
1102
|
-
await (0, import_codegen6.formatAndWriteSolidity)(source, codegenIndexPath, "Generated table index");
|
1103
|
-
}
|
1104
|
-
})
|
1105
|
-
);
|
1106
|
-
(0, import_debug.default)("Generated tables");
|
1107
|
-
}
|
1108
|
-
|
1109
|
-
// ts/codegen/tightcoder/renderDecodeSlice.ts
|
1110
|
-
var import_codegen8 = require("@latticexyz/common/codegen");
|
1111
|
-
var import_internal3 = require("@latticexyz/schema-type/internal");
|
1112
|
-
|
1113
|
-
// ts/codegen/tightcoder/renderFunctions.ts
|
1114
|
-
var import_codegen7 = require("@latticexyz/common/codegen");
|
1115
|
-
function renderTightCoderDecode(element) {
|
1116
|
-
return `
|
1117
|
-
/**
|
1118
|
-
* @notice Decodes a slice into an array of ${element.internalTypeId}.
|
1119
|
-
* @dev Uses TightCoder for initial decoding, and then assembly for memory conversion.
|
1120
|
-
* @param _input The slice to decode.
|
1121
|
-
* @return _output The decoded array of ${element.internalTypeId}.
|
1122
|
-
*/
|
1123
|
-
function decodeArray_${element.internalTypeId}(
|
1124
|
-
Slice _input
|
1125
|
-
) internal pure returns (
|
1126
|
-
${element.internalTypeId}[] memory _output
|
1127
|
-
) {
|
1128
|
-
bytes32[] memory _genericArray = TightCoder.decode(
|
1129
|
-
_input,
|
1130
|
-
${element.staticByteLength},
|
1131
|
-
${(0, import_codegen7.getLeftPaddingBits)(element)}
|
1132
|
-
);
|
1133
|
-
assembly {
|
1134
|
-
_output := _genericArray
|
1135
|
-
}
|
1136
|
-
}
|
1137
|
-
`;
|
1138
|
-
}
|
1139
|
-
function renderTightCoderEncode(element) {
|
1140
|
-
return `
|
1141
|
-
|
1142
|
-
/**
|
1143
|
-
* @notice Encodes an array of ${element.internalTypeId} into a tightly packed bytes representation.
|
1144
|
-
* @param _input The array of ${element.internalTypeId} values to be encoded.
|
1145
|
-
* @return The resulting tightly packed bytes representation of the input array.
|
1146
|
-
*/
|
1147
|
-
function encode(${element.internalTypeId}[] memory _input) internal pure returns (bytes memory) {
|
1148
|
-
bytes32[] memory _genericArray;
|
1149
|
-
assembly {
|
1150
|
-
_genericArray := _input
|
1151
|
-
}
|
1152
|
-
return TightCoder.encode(
|
1153
|
-
_genericArray,
|
1154
|
-
${element.staticByteLength},
|
1155
|
-
${(0, import_codegen7.getLeftPaddingBits)(element)}
|
1156
|
-
);
|
1157
|
-
}
|
1158
|
-
`;
|
1159
|
-
}
|
1160
|
-
|
1161
|
-
// ts/codegen/tightcoder/renderDecodeSlice.ts
|
1162
|
-
function renderDecodeSlice() {
|
1163
|
-
return `
|
1164
|
-
${import_codegen8.renderedSolidityHeader}
|
1165
|
-
import { TightCoder } from "./TightCoder.sol";
|
1166
|
-
import { Slice } from "../Slice.sol";
|
1167
|
-
|
1168
|
-
/**
|
1169
|
-
* @title DecodeSlice Library
|
1170
|
-
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
|
1171
|
-
* @notice A library for decoding slices of data into specific data types.
|
1172
|
-
* @dev This library provides functions for decoding slices into arrays of basic uint types.
|
1173
|
-
*/
|
1174
|
-
library DecodeSlice {
|
1175
|
-
${import_internal3.staticAbiTypes.map(
|
1176
|
-
(staticAbiType) => renderTightCoderDecode({
|
1177
|
-
internalTypeId: staticAbiType,
|
1178
|
-
staticByteLength: import_internal3.staticAbiTypeToByteLength[staticAbiType]
|
1179
|
-
})
|
1180
|
-
).join("\n")}
|
1181
|
-
}
|
1182
|
-
`;
|
1183
|
-
}
|
1184
|
-
|
1185
|
-
// ts/codegen/tightcoder/renderEncodeArray.ts
|
1186
|
-
var import_codegen9 = require("@latticexyz/common/codegen");
|
1187
|
-
var import_internal4 = require("@latticexyz/schema-type/internal");
|
1188
|
-
function renderEncodeArray() {
|
1189
|
-
return `
|
1190
|
-
${import_codegen9.renderedSolidityHeader}
|
1191
|
-
import { TightCoder } from "./TightCoder.sol";
|
1192
|
-
|
1193
|
-
/**
|
1194
|
-
* @title EncodeArray
|
1195
|
-
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
|
1196
|
-
* @dev This library provides utilities for encoding arrays into tightly packed bytes representations.
|
1197
|
-
*/
|
1198
|
-
library EncodeArray {
|
1199
|
-
${import_internal4.staticAbiTypes.map(
|
1200
|
-
(staticAbiType) => renderTightCoderEncode({
|
1201
|
-
internalTypeId: staticAbiType,
|
1202
|
-
staticByteLength: import_internal4.staticAbiTypeToByteLength[staticAbiType]
|
1203
|
-
})
|
1204
|
-
).join("\n")}
|
1205
|
-
}
|
1206
|
-
`;
|
1207
|
-
}
|
1208
|
-
|
1209
|
-
// ts/codegen/tightcoder/renderTightCoderAutoTest.ts
|
1210
|
-
var import_codegen10 = require("@latticexyz/common/codegen");
|
1211
|
-
var import_internal5 = require("@latticexyz/schema-type/internal");
|
1212
|
-
function renderTightCoderAutoTestFunction({ typeId }) {
|
1213
|
-
return `
|
1214
|
-
function testEncodeDecodeArray_${typeId}(
|
1215
|
-
${typeId} val0,
|
1216
|
-
${typeId} val1,
|
1217
|
-
${typeId} val2
|
1218
|
-
) public {
|
1219
|
-
${typeId}[] memory input = new ${typeId}[](3);
|
1220
|
-
input[0] = val0;
|
1221
|
-
input[1] = val1;
|
1222
|
-
input[2] = val2;
|
1223
|
-
|
1224
|
-
bytes memory encoded = EncodeArray.encode(input);
|
1225
|
-
assertEq(encoded, abi.encodePacked(val0, val1, val2));
|
1226
|
-
|
1227
|
-
${typeId}[] memory decoded = SliceLib.fromBytes(encoded).decodeArray_${typeId}();
|
1228
|
-
assertEq(decoded.length, 3);
|
1229
|
-
assertEq(decoded[0], val0);
|
1230
|
-
assertEq(decoded[1], val1);
|
1231
|
-
assertEq(decoded[2], val2);
|
1232
|
-
}
|
1233
|
-
`;
|
1234
|
-
}
|
1235
|
-
function renderTightCoderAutoTest() {
|
1236
|
-
return `
|
1237
|
-
${import_codegen10.renderedSolidityHeader}
|
1238
|
-
|
1239
|
-
import { Test } from "forge-std/Test.sol";
|
1240
|
-
import { EncodeArray } from "../../src/tightcoder/EncodeArray.sol";
|
1241
|
-
import { SliceLib } from "../../src/Slice.sol";
|
1242
|
-
|
1243
|
-
contract TightCoderAutoTest is Test {
|
1244
|
-
${import_internal5.staticAbiTypes.map((staticAbiType) => renderTightCoderAutoTestFunction({ typeId: staticAbiType })).join("")}
|
1245
|
-
}
|
1246
|
-
`;
|
1247
|
-
}
|
1248
|
-
// Annotate the CommonJS export names for ESM import in node:
|
1249
|
-
0 && (module.exports = {
|
1250
|
-
getSchemaTypeInfo,
|
1251
|
-
getTableOptions,
|
1252
|
-
getUserTypeInfo,
|
1253
|
-
renderDecodeSlice,
|
1254
|
-
renderDecodeValueType,
|
1255
|
-
renderDeleteRecordMethods,
|
1256
|
-
renderEncodeArray,
|
1257
|
-
renderEncodeFieldSingle,
|
1258
|
-
renderFieldMethods,
|
1259
|
-
renderRecordData,
|
1260
|
-
renderRecordMethods,
|
1261
|
-
renderTable,
|
1262
|
-
renderTightCoderAutoTest,
|
1263
|
-
renderTightCoderAutoTestFunction,
|
1264
|
-
renderTightCoderDecode,
|
1265
|
-
renderTightCoderEncode,
|
1266
|
-
renderTypesFromConfig,
|
1267
|
-
resolveAbiOrUserType,
|
1268
|
-
tablegen
|
1269
|
-
});
|
1270
|
-
//# sourceMappingURL=codegen.cjs.map
|