@ariestools/cli 0.1.19 → 0.1.22

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.
@@ -92,7 +92,8 @@ function encodeStatus(status) {
92
92
  async function readIndexerStatus(store, key = STATUS_KEY) {
93
93
  const body = await store.get(key);
94
94
  if (body === void 0) return void 0;
95
- const parsed = JSON.parse(new TextDecoder().decode(body));
95
+ const decoder = new TextDecoder();
96
+ const parsed = JSON.parse(decoder.decode(body));
96
97
  if (parsed === null || typeof parsed !== "object") throw new Error(`Invalid indexer status at "${key}": not an object`);
97
98
  const record = parsed;
98
99
  if (record.schema !== "network.aries.dapp.indexer.status") throw new Error(`Invalid indexer status schema at "${key}": ${String(record.schema)}`);
@@ -100,14 +101,15 @@ async function readIndexerStatus(store, key = STATUS_KEY) {
100
101
  }
101
102
  /**
102
103
  * Publish a machine-readable status object with revalidate CDN caching.
103
- * Status never carries credentials or private application material.
104
+ * Status never carries credentials or private app material.
104
105
  */
105
106
  async function writeIndexerStatus(store, input) {
106
107
  const key = input.key ?? "status.json";
108
+ const now = /* @__PURE__ */ new Date();
107
109
  const status = {
108
110
  schema: INDEXER_STATUS_SCHEMA,
109
111
  consecutiveFailures: input.consecutiveFailures,
110
- updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
112
+ updatedAt: now.toISOString(),
111
113
  ...input.floor !== void 0 && { floor: input.floor },
112
114
  ...input.cursor !== void 0 && { cursor: input.cursor },
113
115
  ...input.lastCompletedPosition !== void 0 && { lastCompletedPosition: input.lastCompletedPosition },
@@ -181,7 +183,7 @@ function failureStatusFields(prior, consecutiveFailures, error, now) {
181
183
  };
182
184
  }
183
185
  //#endregion
184
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/decorate.js
186
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
185
187
  function __decorate(decorators, target, key, desc) {
186
188
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
187
189
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -304,8 +306,8 @@ Strip a role prefix from a physical key, returning the relative key.
304
306
  function stripPrefix(prefix, physicalKey) {
305
307
  const cleanPrefix = prefix.replaceAll(/^\/+|\/+$/g, "");
306
308
  if (cleanPrefix.length === 0) return physicalKey;
307
- const withSlash = `${cleanPrefix}/`;
308
309
  if (physicalKey === cleanPrefix) return "";
310
+ const withSlash = `${cleanPrefix}/`;
309
311
  if (physicalKey.startsWith(withSlash)) return physicalKey.slice(withSlash.length);
310
312
  return physicalKey;
311
313
  }
@@ -331,7 +333,8 @@ function isConditionalFailure(error) {
331
333
  return name === "PreconditionFailed" || name === "ConditionalRequestConflict" || name === "412" || status === 412;
332
334
  }
333
335
  function toBodyBytes(body) {
334
- return typeof body === "string" ? new TextEncoder().encode(body) : body;
336
+ if (typeof body !== "string") return body;
337
+ return new TextEncoder().encode(body);
335
338
  }
336
339
  function metaFromResponse(response) {
337
340
  return {
@@ -394,9 +397,7 @@ function createS3BucketStore(options) {
394
397
  bucket,
395
398
  prefix: bindingPrefix,
396
399
  ...publicBaseUrl !== void 0 && { publicBaseUrl },
397
- resolveKey(key) {
398
- return resolve(key);
399
- },
400
+ resolveKey: (key) => resolve(key),
400
401
  publicUrl(key) {
401
402
  if (publicBaseUrl === void 0) return void 0;
402
403
  const relative = key.replaceAll(/^\/+/g, "");
@@ -595,9 +596,7 @@ function createDappLocator(options) {
595
596
  let destroyed = false;
596
597
  return {
597
598
  context: { logger },
598
- has(moniker) {
599
- return instances.has(moniker);
600
- },
599
+ has: (moniker) => instances.has(moniker),
601
600
  register(moniker, instance) {
602
601
  instances.set(moniker, instance);
603
602
  },
@@ -606,9 +605,7 @@ function createDappLocator(options) {
606
605
  if (found === void 0) throw new Error(`No provider registered for moniker "${moniker}"`);
607
606
  return found;
608
607
  },
609
- async tryGetInstance(moniker) {
610
- return instances.get(moniker);
611
- },
608
+ tryGetInstance: async (moniker) => instances.get(moniker),
612
609
  destroy() {
613
610
  if (destroyed) return;
614
611
  destroyed = true;
@@ -649,7 +646,7 @@ function resolvePackageUrl(spec) {
649
646
  }
650
647
  function pickReducer(mod, exportName) {
651
648
  if (exportName !== void 0 && exportName.length > 0) {
652
- if (!(exportName in mod)) throw new Error(`Reducer module has no export named "${exportName}"`);
649
+ if (!Object.hasOwn(mod, exportName)) throw new Error(`Reducer module has no export named "${exportName}"`);
653
650
  return mod[exportName];
654
651
  }
655
652
  if (mod.default !== void 0) return mod.default;
@@ -752,9 +749,13 @@ async function main() {
752
749
  await server.close();
753
750
  }
754
751
  }
755
- main().catch((error) => {
756
- console.error(error);
757
- process.exit(1);
758
- });
752
+ (async () => {
753
+ try {
754
+ await main();
755
+ } catch (error) {
756
+ console.error(error);
757
+ process.exit(1);
758
+ }
759
+ })();
759
760
  //#endregion
760
761
  export {};