@ariestools/cli 0.1.16 → 0.1.17

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.
Files changed (52) hide show
  1. package/README.md +51 -11
  2. package/dist/bin/aries.mjs +94138 -253208
  3. package/dist/bin/daemons/chain-server.mjs +9862 -12
  4. package/dist/bin/daemons/dapp-server.mjs +55 -56
  5. package/dist/bin/daemons/datalake-dev.mjs +10282 -4342
  6. package/dist/node/datalake.mjs +7 -5
  7. package/dist/terraform/cluster-aws/cluster.tf +61 -0
  8. package/dist/terraform/cluster-aws/encryption.tofu.example +37 -0
  9. package/dist/terraform/cluster-aws/iam.tf +81 -0
  10. package/dist/terraform/cluster-aws/irsa_ebs_csi.tf +37 -0
  11. package/dist/terraform/cluster-aws/kubeconfig.tf +49 -0
  12. package/dist/terraform/cluster-aws/network.tf +108 -0
  13. package/dist/terraform/cluster-aws/nodegroup.tf +42 -0
  14. package/dist/terraform/cluster-aws/outputs.tf +80 -0
  15. package/dist/terraform/cluster-aws/providers.tf +7 -0
  16. package/dist/terraform/cluster-aws/terraform.tfvars.example +21 -0
  17. package/dist/terraform/cluster-aws/variables.tf +120 -0
  18. package/dist/terraform/cluster-aws/versions.tf +18 -0
  19. package/dist/terraform/cluster-azure/cluster.tf +83 -0
  20. package/dist/terraform/cluster-azure/encryption.tofu.example +37 -0
  21. package/dist/terraform/cluster-azure/identity.tf +9 -0
  22. package/dist/terraform/cluster-azure/kubeconfig.tf +18 -0
  23. package/dist/terraform/cluster-azure/network.tf +23 -0
  24. package/dist/terraform/cluster-azure/outputs.tf +69 -0
  25. package/dist/terraform/cluster-azure/providers.tf +16 -0
  26. package/dist/terraform/cluster-azure/terraform.tfvars.example +24 -0
  27. package/dist/terraform/cluster-azure/variables.tf +126 -0
  28. package/dist/terraform/cluster-azure/versions.tf +14 -0
  29. package/dist/terraform/cluster-gcp/cluster.tf +71 -0
  30. package/dist/terraform/cluster-gcp/encryption.tofu.example +35 -0
  31. package/dist/terraform/cluster-gcp/kubeconfig.tf +47 -0
  32. package/dist/terraform/cluster-gcp/network.tf +47 -0
  33. package/dist/terraform/cluster-gcp/outputs.tf +70 -0
  34. package/dist/terraform/cluster-gcp/providers.tf +14 -0
  35. package/dist/terraform/cluster-gcp/terraform.tfvars.example +17 -0
  36. package/dist/terraform/cluster-gcp/variables.tf +86 -0
  37. package/dist/terraform/cluster-gcp/versions.tf +14 -0
  38. package/dist/terraform/serverless-aws/alb.tf +127 -0
  39. package/dist/terraform/serverless-aws/database.tf +70 -0
  40. package/dist/terraform/serverless-aws/dns.tf +80 -0
  41. package/dist/terraform/serverless-aws/ecr.tf +63 -0
  42. package/dist/terraform/serverless-aws/ecs.tf +199 -0
  43. package/dist/terraform/serverless-aws/encryption.tofu.example +38 -0
  44. package/dist/terraform/serverless-aws/iam.tf +68 -0
  45. package/dist/terraform/serverless-aws/network.tf +190 -0
  46. package/dist/terraform/serverless-aws/outputs.tf +64 -0
  47. package/dist/terraform/serverless-aws/providers.tf +19 -0
  48. package/dist/terraform/serverless-aws/storage.tf +51 -0
  49. package/dist/terraform/serverless-aws/terraform.tfvars.example +19 -0
  50. package/dist/terraform/serverless-aws/variables.tf +151 -0
  51. package/dist/terraform/serverless-aws/versions.tf +14 -0
  52. package/package.json +22 -19
@@ -3,13 +3,17 @@ import { createRequire } from "node:module";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { homedir } from "node:os";
5
5
  import path from "node:path";
6
+ import { runActorsService } from "@ariestools/actor-cli";
6
7
  import { DAPP_BACKINGS, DAPP_BUCKETS, isDappBackingKind, resolveBacking, startDappServer } from "@ariestools/aries-dapp-serve";
8
+ import { createNodeProcessHost } from "@ariestools/cli-kit-node";
7
9
  import { ConsoleLogger, assertEx, creatable } from "@ariestools/sdk";
8
- import { PeriodicActor, bootActors } from "@ariestools/actor";
10
+ import { PeriodicActor } from "@ariestools/actor";
9
11
  import { DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, ListObjectsV2Command, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
10
12
  import { pathToFileURL } from "node:url";
11
13
  //#region src/providers/capabilities.ts
12
- /** Thrown when a read-only capability wrapper receives a write. */
14
+ /**
15
+ Thrown when a read-only capability wrapper receives a write.
16
+ */
13
17
  var ReadOnlyStoreError = class extends Error {
14
18
  name = "ReadOnlyStoreError";
15
19
  constructor(role, operation = "put") {
@@ -66,10 +70,14 @@ const DappStateStoreMoniker = "DappStateStore";
66
70
  const DappIndexStoreMoniker = "DappIndexStore";
67
71
  //#endregion
68
72
  //#region src/publication/constants.ts
69
- /** Well-known relative keys published by the coherent generation protocol. */
73
+ /**
74
+ Well-known relative keys published by the coherent generation protocol.
75
+ */
70
76
  const HEAD_KEY = "head.json";
71
77
  const STATUS_KEY = "status.json";
72
- /** CDN caching: mutable head and status objects that must revalidate. */
78
+ /**
79
+ CDN caching: mutable head and status objects that must revalidate.
80
+ */
73
81
  const CACHE_CONTROL_REVALIDATE = "public, max-age=0, must-revalidate";
74
82
  const INDEXER_STATUS_SCHEMA = "network.aries.dapp.indexer.status";
75
83
  //#endregion
@@ -134,7 +142,9 @@ const PROGRESS_KEYS = [
134
142
  "generation",
135
143
  "generationRoot"
136
144
  ];
137
- /** Carry forward durable progress fields from a prior status object. */
145
+ /**
146
+ Carry forward durable progress fields from a prior status object.
147
+ */
138
148
  function priorProgressFields(prior) {
139
149
  if (prior === void 0) return {};
140
150
  return {
@@ -142,7 +152,9 @@ function priorProgressFields(prior) {
142
152
  ...prior.lastSuccessAt !== void 0 && { lastSuccessAt: prior.lastSuccessAt }
143
153
  };
144
154
  }
145
- /** Build success status fields from reduce progress, falling back to prior. */
155
+ /**
156
+ Build success status fields from reduce progress, falling back to prior.
157
+ */
146
158
  function successStatusFields(progress, prior, now) {
147
159
  const fromProgress = progress === void 0 ? {} : pickDefined(progress, PROGRESS_KEYS);
148
160
  const generation = progress?.generation ?? prior?.generation;
@@ -157,7 +169,9 @@ function successStatusFields(progress, prior, now) {
157
169
  ...prior?.lastErrorAt !== void 0 && { lastErrorAt: prior.lastErrorAt }
158
170
  };
159
171
  }
160
- /** Build failure status fields while preserving prior checkpoint progress. */
172
+ /**
173
+ Build failure status fields while preserving prior checkpoint progress.
174
+ */
161
175
  function failureStatusFields(prior, consecutiveFailures, error, now) {
162
176
  return {
163
177
  consecutiveFailures,
@@ -167,7 +181,7 @@ function failureStatusFields(prior, consecutiveFailures, error, now) {
167
181
  };
168
182
  }
169
183
  //#endregion
170
- //#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorate.js
184
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/decorate.js
171
185
  function __decorate(decorators, target, key, desc) {
172
186
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
173
187
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -194,11 +208,15 @@ let DappActor = class DappActor extends PeriodicActor {
194
208
  _data;
195
209
  _index;
196
210
  _state;
197
- /** Dapp actors require a logger in the locator context (see {@link DappContext}). */
211
+ /**
212
+ Dapp actors require a logger in the locator context (see {@link DappContext}).
213
+ */
198
214
  get logger() {
199
215
  return assertEx(super.logger, () => `Logger is required in context for actor ${this.name}.`);
200
216
  }
201
- /** Reduce cadence: `reduceIntervalMs` names the interval in dapp configs. */
217
+ /**
218
+ Reduce cadence: `reduceIntervalMs` names the interval in dapp configs.
219
+ */
202
220
  get intervalMs() {
203
221
  return this.params.reduceIntervalMs ?? DEFAULT_REDUCE_INTERVAL_MS;
204
222
  }
@@ -213,7 +231,9 @@ let DappActor = class DappActor extends PeriodicActor {
213
231
  await super.startHandler();
214
232
  this.logger.info(`DappActor started: reducer '${this.params.reducer.name}' every ${this.intervalMs}ms (first run in ${this.firstRunDelayMs}ms)`);
215
233
  }
216
- /** Failure side-channel: publish durable failure status (count already incremented). */
234
+ /**
235
+ Failure side-channel: publish durable failure status (count already incremented).
236
+ */
217
237
  async onPassError(error) {
218
238
  await this.safePublishStatus(void 0, error);
219
239
  }
@@ -251,33 +271,6 @@ let DappActor = class DappActor extends PeriodicActor {
251
271
  };
252
272
  DappActor = __decorate([creatable()], DappActor);
253
273
  //#endregion
254
- //#region src/boot/bootDappActors.ts
255
- /**
256
- * Creates and starts one {@link DappActor} per spec, all sharing the single
257
- * process-wide locator. A thin wrapper over actor-kit's `bootActors`: on
258
- * partial failure, actors already started are stopped (with shutdown
259
- * fallback) before the error is rethrown. Returns them so the caller can
260
- * stop them on shutdown.
261
- */
262
- async function bootDappActors(locator, specs) {
263
- return await bootActors(specs.map((spec) => {
264
- const params = {
265
- locator,
266
- name: spec.name,
267
- reducer: spec.reducer,
268
- ...spec.reduceIntervalMs !== void 0 && { reduceIntervalMs: spec.reduceIntervalMs },
269
- ...spec.firstRunDelayMs !== void 0 && { firstRunDelayMs: spec.firstRunDelayMs },
270
- ...spec.maxConsecutiveFailures !== void 0 && { maxConsecutiveFailures: spec.maxConsecutiveFailures },
271
- ...spec.publishStatus !== void 0 && { publishStatus: spec.publishStatus },
272
- ...spec.shutdownTimeoutMs !== void 0 && { shutdownTimeoutMs: spec.shutdownTimeoutMs }
273
- };
274
- return {
275
- create: () => DappActor.create(params),
276
- ...spec.runReady !== void 0 && { runReady: spec.runReady }
277
- };
278
- }));
279
- }
280
- //#endregion
281
274
  //#region src/providers/errors.ts
282
275
  /**
283
276
  * Thrown when a conditional put fails (object already exists under
@@ -305,7 +298,9 @@ function joinKey(prefix, relativeKey) {
305
298
  if (cleanKey.length === 0) return cleanPrefix;
306
299
  return `${cleanPrefix}/${cleanKey}`;
307
300
  }
308
- /** Strip a role prefix from a physical key, returning the relative key. */
301
+ /**
302
+ Strip a role prefix from a physical key, returning the relative key.
303
+ */
309
304
  function stripPrefix(prefix, physicalKey) {
310
305
  const cleanPrefix = prefix.replaceAll(/^\/+|\/+$/g, "");
311
306
  if (cleanPrefix.length === 0) return physicalKey;
@@ -314,7 +309,9 @@ function stripPrefix(prefix, physicalKey) {
314
309
  if (physicalKey.startsWith(withSlash)) return physicalKey.slice(withSlash.length);
315
310
  return physicalKey;
316
311
  }
317
- /** Normalize an optional public base URL (no trailing slash). */
312
+ /**
313
+ Normalize an optional public base URL (no trailing slash).
314
+ */
318
315
  function normalizePublicBaseUrl(url) {
319
316
  if (url === void 0 || url.length === 0) return void 0;
320
317
  return url.replace(/\/+$/, "");
@@ -730,28 +727,30 @@ async function main() {
730
727
  });
731
728
  process.env.DAPP_PUBLICATION_SAFETY ??= "unfenced";
732
729
  process.env.DAPP_ENDPOINT ??= server.baseUrl;
733
- const actors = await bootDappActors(locator, [{
730
+ const actors = [await DappActor.create({
731
+ firstRunDelayMs: FIRST_RUN_DELAY_MS,
732
+ locator,
734
733
  name: "DappActor",
735
- reducer,
734
+ publishStatus: reducer.name !== "noop",
736
735
  reduceIntervalMs: REDUCE_INTERVAL_MS,
737
- firstRunDelayMs: FIRST_RUN_DELAY_MS,
738
- publishStatus: reducer.name !== "noop"
739
- }]);
736
+ reducer
737
+ })];
740
738
  const versionSuffix = reducer.version === void 0 ? "" : `@${reducer.version}`;
741
739
  const reducerLine = REDUCER_SPEC === void 0 ? "\nreducer: noop (pass DAPP_REDUCER / --reducer for real logic)" : `\nreducer: ${REDUCER_SPEC}`;
742
- console.log(`[dev-only] dapp server listening at ${server.baseUrl}\n` + DAPP_BUCKETS.map((bucket) => ` /${bucket.padEnd(5)} ${server.baseUrl}/${bucket}`).join("\n") + `\nbacking: ${backing.description}\nactors: ${actors.length} (reducer '${reducer.name}'${versionSuffix}, every ${REDUCE_INTERVAL_MS}ms)` + reducerLine);
743
- const shutdown = async () => {
744
- for (const actor of actors) await actor.stop();
740
+ const banner = `[dev-only] dapp server listening at ${server.baseUrl}\n` + DAPP_BUCKETS.map((bucket) => ` /${bucket.padEnd(5)} ${server.baseUrl}/${bucket}`).join("\n") + `\nbacking: ${backing.description}\nactors: ${actors.length} (reducer '${reducer.name}'${versionSuffix}, every ${REDUCE_INTERVAL_MS}ms)` + reducerLine;
741
+ const processHost = createNodeProcessHost({ signals: ["SIGINT", "SIGTERM"] });
742
+ try {
743
+ await runActorsService(processHost, {
744
+ actors,
745
+ onReady: () => {
746
+ console.log(banner);
747
+ },
748
+ supervisor: "parallel"
749
+ });
750
+ } finally {
745
751
  locator.destroy();
746
752
  await server.close();
747
- process.exit(0);
748
- };
749
- process.on("SIGINT", () => {
750
- shutdown();
751
- });
752
- process.on("SIGTERM", () => {
753
- shutdown();
754
- });
753
+ }
755
754
  }
756
755
  main().catch((error) => {
757
756
  console.error(error);