@ariestools/aries-dapp-serve 0.1.7 → 0.1.9

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 CHANGED
@@ -1,10 +1,8 @@
1
1
  # @ariestools/aries-dapp-serve
2
2
 
3
3
  > **Dev only.** This package is a local development fixture — it accepts any
4
- > S3 credentials, carries no auth or metrics, and only ships an ephemeral
5
- > in-memory backing. It is not meant for production at this time; production
6
- > dapp backends are published to real object storage (S3/R2) behind the
7
- > standard sub-domain layout.
4
+ > S3 credentials, carries no auth or metrics. It is not meant for production;
5
+ > production dapp backends publish to real object storage (S3/R2).
8
6
 
9
7
  Serves a dapp backend's layout from a single origin using subfolders
10
8
  (`/state`, `/data`, `/index`) — the S3-compatible storage half of the
@@ -27,5 +25,22 @@ and the actor, live in
27
25
  [`@ariestools/aries-dapp-core`](../dapp-core). `aries dapp up` spawns that
28
26
  composed daemon.
29
27
 
30
- Backings (`DappBackingKind`): `memory` (ephemeral temp directory, wiped on
31
- shutdown). `disk` and `s3` are planned.
28
+ ## Backings
29
+
30
+ | Kind | Behavior |
31
+ | --- | --- |
32
+ | `memory` | Ephemeral temp directory, wiped on `close()` / process shutdown |
33
+ | `disk` | Caller-owned directory (e.g. `~/.aries/dapp/data`); survives restarts; `cleanup()` is a no-op |
34
+
35
+ ```ts
36
+ import {
37
+ createDiskBacking, createMemoryBacking, startDappServer,
38
+ } from '@ariestools/aries-dapp-serve'
39
+
40
+ const server = await startDappServer({
41
+ backing: createDiskBacking('/var/lib/aries-dapp'),
42
+ port: 8801,
43
+ })
44
+ ```
45
+
46
+ `s3` (proxy a remote bucket without embedding s3rver) is not implemented yet.
@@ -1,12 +1,14 @@
1
- export declare const DAPP_BACKINGS: readonly ["memory"];
1
+ export declare const DAPP_BACKINGS: readonly ["memory", "disk"];
2
2
  export type DappBackingKind = typeof DAPP_BACKINGS[number];
3
3
  export declare function isDappBackingKind(value: string): value is DappBackingKind;
4
4
  /**
5
- * Where the served dapp layout's objects live. v1 ships only `memory` (an
6
- * ephemeral temp directory wiped on shutdown); a `disk` kind (caller-owned
7
- * directory, no-op cleanup) is the natural next addition. An `s3` kind will
8
- * proxy a remote bucket instead of running a local store, so it will lift
9
- * this seam up to the server level rather than fit this interface.
5
+ * Where the served dapp layout's objects live.
6
+ *
7
+ * - `memory` ephemeral temp directory wiped on shutdown
8
+ * - `disk` caller-owned directory; survives restarts; cleanup is a no-op
9
+ *
10
+ * An `s3` kind would proxy a remote bucket and lift this seam to the server
11
+ * level rather than fit this interface.
10
12
  */
11
13
  export interface DappBacking {
12
14
  /** Human-readable label for banners and status output. */
@@ -16,6 +18,19 @@ export interface DappBacking {
16
18
  cleanup(): Promise<void>;
17
19
  prepare(): Promise<void>;
18
20
  }
21
+ export interface ResolveBackingOptions {
22
+ /**
23
+ * Required for `disk`: absolute path the S3rver root lives under.
24
+ * Ignored for `memory`.
25
+ */
26
+ directory?: string;
27
+ }
19
28
  export declare function createMemoryBacking(): DappBacking;
20
- export declare function resolveBacking(kind: DappBackingKind): DappBacking;
29
+ /**
30
+ * Caller-owned on-disk backing. Survives process restarts. `cleanup()` is a
31
+ * no-op so `aries dapp down` does not wipe data; use `aries dapp reset` (or
32
+ * delete the directory) to clear.
33
+ */
34
+ export declare function createDiskBacking(directory: string): DappBacking;
35
+ export declare function resolveBacking(kind: DappBackingKind, options?: ResolveBackingOptions): DappBacking;
21
36
  //# sourceMappingURL=DappBacking.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DappBacking.d.ts","sourceRoot":"","sources":["../../src/DappBacking.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,qBAAsB,CAAA;AAChD,MAAM,MAAM,eAAe,GAAG,OAAO,aAAa,CAAC,MAAM,CAAC,CAAA;AAE1D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,eAAe,CAEzE;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,0DAA0D;IAC1D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,oGAAoG;IACpG,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACxB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB;AAED,wBAAgB,mBAAmB,IAAI,WAAW,CAgBjD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,WAAW,CAMjE"}
1
+ {"version":3,"file":"DappBacking.d.ts","sourceRoot":"","sources":["../../src/DappBacking.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,6BAA8B,CAAA;AACxD,MAAM,MAAM,eAAe,GAAG,OAAO,aAAa,CAAC,MAAM,CAAC,CAAA;AAE1D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,eAAe,CAEzE;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,0DAA0D;IAC1D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,oGAAoG;IACpG,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACxB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB;AAED,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,mBAAmB,IAAI,WAAW,CAgBjD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,CAchE;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,eAAe,EACrB,OAAO,GAAE,qBAA0B,GAClC,WAAW,CAYb"}
@@ -1,5 +1,5 @@
1
- export type { DappBacking, DappBackingKind } from './DappBacking.ts';
2
- export { createMemoryBacking, DAPP_BACKINGS, isDappBackingKind, resolveBacking, } from './DappBacking.ts';
1
+ export type { DappBacking, DappBackingKind, ResolveBackingOptions, } from './DappBacking.ts';
2
+ export { createDiskBacking, createMemoryBacking, DAPP_BACKINGS, isDappBackingKind, resolveBacking, } from './DappBacking.ts';
3
3
  export type { DappBucket, DappServerOptions, RunningDappServer, } from './startDappServer.ts';
4
4
  export { DAPP_BUCKETS, startDappServer } from './startDappServer.ts';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EACL,mBAAmB,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,GACtE,MAAM,kBAAkB,CAAA;AACzB,YAAY,EACV,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,GACjD,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EAAE,eAAe,EAAE,qBAAqB,GACpD,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,cAAc,GACf,MAAM,kBAAkB,CAAA;AACzB,YAAY,EACV,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,GACjD,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA"}
@@ -1,8 +1,9 @@
1
1
  // src/DappBacking.ts
2
+ import { mkdirSync } from "node:fs";
2
3
  import { mkdtemp, rm } from "node:fs/promises";
3
4
  import { tmpdir } from "node:os";
4
5
  import path from "node:path";
5
- var DAPP_BACKINGS = ["memory"];
6
+ var DAPP_BACKINGS = ["memory", "disk"];
6
7
  function isDappBackingKind(value) {
7
8
  return DAPP_BACKINGS.includes(value);
8
9
  }
@@ -23,11 +24,31 @@ function createMemoryBacking() {
23
24
  }
24
25
  };
25
26
  }
26
- function resolveBacking(kind) {
27
+ function createDiskBacking(directory) {
28
+ const resolved = path.resolve(directory);
29
+ return {
30
+ description: `disk (${resolved})`,
31
+ get directory() {
32
+ return resolved;
33
+ },
34
+ async prepare() {
35
+ mkdirSync(resolved, { recursive: true });
36
+ },
37
+ async cleanup() {
38
+ }
39
+ };
40
+ }
41
+ function resolveBacking(kind, options = {}) {
27
42
  switch (kind) {
28
43
  case "memory": {
29
44
  return createMemoryBacking();
30
45
  }
46
+ case "disk": {
47
+ if (options.directory === void 0 || options.directory.length === 0) {
48
+ throw new Error("disk backing requires a directory (DAPP_DATA_DIR / --data-dir)");
49
+ }
50
+ return createDiskBacking(options.directory);
51
+ }
31
52
  }
32
53
  }
33
54
 
@@ -77,6 +98,7 @@ async function startDappServer(options) {
77
98
  export {
78
99
  DAPP_BACKINGS,
79
100
  DAPP_BUCKETS,
101
+ createDiskBacking,
80
102
  createMemoryBacking,
81
103
  isDappBackingKind,
82
104
  resolveBacking,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/DappBacking.ts", "../../src/startDappServer.ts"],
4
- "sourcesContent": ["import { mkdtemp, rm } from 'node:fs/promises'\nimport { tmpdir } from 'node:os'\nimport path from 'node:path'\n\nexport const DAPP_BACKINGS = ['memory'] as const\nexport type DappBackingKind = typeof DAPP_BACKINGS[number]\n\nexport function isDappBackingKind(value: string): value is DappBackingKind {\n return (DAPP_BACKINGS as readonly string[]).includes(value)\n}\n\n/**\n * Where the served dapp layout's objects live. v1 ships only `memory` (an\n * ephemeral temp directory wiped on shutdown); a `disk` kind (caller-owned\n * directory, no-op cleanup) is the natural next addition. An `s3` kind will\n * proxy a remote bucket instead of running a local store, so it will lift\n * this seam up to the server level rather than fit this interface.\n */\nexport interface DappBacking {\n /** Human-readable label for banners and status output. */\n readonly description: string\n /** Directory the S3-compatible server persists bucket objects under. Only valid after prepare(). */\n readonly directory: string\n cleanup(): Promise<void>\n prepare(): Promise<void>\n}\n\nexport function createMemoryBacking(): DappBacking {\n let dir: string | undefined\n return {\n description: 'memory (ephemeral temp directory)',\n get directory(): string {\n if (dir === undefined) throw new Error('Memory backing not prepared')\n return dir\n },\n async prepare(): Promise<void> {\n dir ??= await mkdtemp(path.join(tmpdir(), 'aries-dapp-'))\n },\n async cleanup(): Promise<void> {\n if (dir !== undefined) await rm(dir, { recursive: true, force: true })\n dir = undefined\n },\n }\n}\n\nexport function resolveBacking(kind: DappBackingKind): DappBacking {\n switch (kind) {\n case 'memory': {\n return createMemoryBacking()\n }\n }\n}\n", "import S3rver from 's3rver'\n\nimport type { DappBacking } from './DappBacking.ts'\n\n/**\n * The bucket-per-role split of a dapp backend's layout. Path-style\n * addressing turns each bucket into a subfolder of the one origin \u2014\n * `/state`, `/data`, `/index`:\n *\n * - `data` \u2014 immutable, append-only facts (the source of truth)\n * - `state` \u2014 mutable current derived view, rebuilt by the DappActor\n * - `index` \u2014 query-optimized derived views, rebuilt by the DappActor\n */\nexport const DAPP_BUCKETS = ['state', 'data', 'index'] as const\nexport type DappBucket = typeof DAPP_BUCKETS[number]\n\nconst DEFAULT_HOST = '127.0.0.1'\nconst DEFAULT_PORT = 8801\n\n/** Allow browser dapp clients to read the layout cross-origin. */\nconst CORS_ALLOW_READS = `<CORSConfiguration>\n <CORSRule>\n <AllowedOrigin>*</AllowedOrigin>\n <AllowedMethod>GET</AllowedMethod>\n <AllowedMethod>HEAD</AllowedMethod>\n <AllowedHeader>*</AllowedHeader>\n </CORSRule>\n</CORSConfiguration>`\n\nexport interface DappServerOptions {\n backing: DappBacking\n host?: string\n port?: number\n publicHost?: string\n silent?: boolean\n tls?: {\n cert: string | Buffer\n key: string | Buffer\n }\n}\n\nexport interface RunningDappServer {\n baseUrl: string\n port: number\n close(): Promise<void>\n}\n\n/**\n * Boots an S3-compatible server (s3rver) pre-configured with the three dapp\n * layout buckets. Writers use the S3 API (any credentials are accepted);\n * readers fetch `/{bucket}/{layout-path}` over HTTP or optional TLS.\n *\n * DEV ONLY \u2014 this server is a local development fixture, not a production\n * dapp host. It intentionally skips the production concerns the datalake and\n * signing-pool planes carry (auth, metrics, durable multi-instance storage):\n * any S3 credentials are accepted and the only backing is an ephemeral temp\n * directory. Production dapps stay on real object storage (S3/R2) behind the\n * standard sub-domain layout.\n */\nexport async function startDappServer(options: DappServerOptions): Promise<RunningDappServer> {\n const host = options.host ?? DEFAULT_HOST\n const publicHost = options.publicHost ?? host\n await options.backing.prepare()\n const server = new S3rver({\n address: host,\n allowMismatchedSignatures: true,\n cert: options.tls?.cert,\n configureBuckets: DAPP_BUCKETS.map(name => ({ name, configs: [CORS_ALLOW_READS] })),\n directory: options.backing.directory,\n key: options.tls?.key,\n port: options.port ?? DEFAULT_PORT,\n silent: options.silent ?? false,\n vhostBuckets: false,\n })\n try {\n const { port } = await server.run()\n return {\n baseUrl: `${options.tls === undefined ? 'http' : 'https'}://${publicHost}:${port}`,\n port,\n close: async (): Promise<void> => {\n await server.close()\n await options.backing.cleanup()\n },\n }\n } catch (error) {\n await options.backing.cleanup()\n throw error\n }\n}\n"],
5
- "mappings": ";AAAA,SAAS,SAAS,UAAU;AAC5B,SAAS,cAAc;AACvB,OAAO,UAAU;AAEV,IAAM,gBAAgB,CAAC,QAAQ;AAG/B,SAAS,kBAAkB,OAAyC;AACzE,SAAQ,cAAoC,SAAS,KAAK;AAC5D;AAkBO,SAAS,sBAAmC;AACjD,MAAI;AACJ,SAAO;AAAA,IACL,aAAa;AAAA,IACb,IAAI,YAAoB;AACtB,UAAI,QAAQ,OAAW,OAAM,IAAI,MAAM,6BAA6B;AACpE,aAAO;AAAA,IACT;AAAA,IACA,MAAM,UAAyB;AAC7B,cAAQ,MAAM,QAAQ,KAAK,KAAK,OAAO,GAAG,aAAa,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Q,QAAQ,QAAQ;AAC9B,UAAM;AAAA,EACR;AACF;",
4
+ "sourcesContent": ["import { mkdirSync } from 'node:fs'\nimport { mkdtemp, rm } from 'node:fs/promises'\nimport { tmpdir } from 'node:os'\nimport path from 'node:path'\n\nexport const DAPP_BACKINGS = ['memory', 'disk'] as const\nexport type DappBackingKind = typeof DAPP_BACKINGS[number]\n\nexport function isDappBackingKind(value: string): value is DappBackingKind {\n return (DAPP_BACKINGS as readonly string[]).includes(value)\n}\n\n/**\n * Where the served dapp layout's objects live.\n *\n * - `memory` \u2014 ephemeral temp directory wiped on shutdown\n * - `disk` \u2014 caller-owned directory; survives restarts; cleanup is a no-op\n *\n * An `s3` kind would proxy a remote bucket and lift this seam to the server\n * level rather than fit this interface.\n */\nexport interface DappBacking {\n /** Human-readable label for banners and status output. */\n readonly description: string\n /** Directory the S3-compatible server persists bucket objects under. Only valid after prepare(). */\n readonly directory: string\n cleanup(): Promise<void>\n prepare(): Promise<void>\n}\n\nexport interface ResolveBackingOptions {\n /**\n * Required for `disk`: absolute path the S3rver root lives under.\n * Ignored for `memory`.\n */\n directory?: string\n}\n\nexport function createMemoryBacking(): DappBacking {\n let dir: string | undefined\n return {\n description: 'memory (ephemeral temp directory)',\n get directory(): string {\n if (dir === undefined) throw new Error('Memory backing not prepared')\n return dir\n },\n async prepare(): Promise<void> {\n dir ??= await mkdtemp(path.join(tmpdir(), 'aries-dapp-'))\n },\n async cleanup(): Promise<void> {\n if (dir !== undefined) await rm(dir, { recursive: true, force: true })\n dir = undefined\n },\n }\n}\n\n/**\n * Caller-owned on-disk backing. Survives process restarts. `cleanup()` is a\n * no-op so `aries dapp down` does not wipe data; use `aries dapp reset` (or\n * delete the directory) to clear.\n */\nexport function createDiskBacking(directory: string): DappBacking {\n const resolved = path.resolve(directory)\n return {\n description: `disk (${resolved})`,\n get directory(): string {\n return resolved\n },\n async prepare(): Promise<void> {\n mkdirSync(resolved, { recursive: true })\n },\n async cleanup(): Promise<void> {\n // intentionally retained\n },\n }\n}\n\nexport function resolveBacking(\n kind: DappBackingKind,\n options: ResolveBackingOptions = {},\n): DappBacking {\n switch (kind) {\n case 'memory': {\n return createMemoryBacking()\n }\n case 'disk': {\n if (options.directory === undefined || options.directory.length === 0) {\n throw new Error('disk backing requires a directory (DAPP_DATA_DIR / --data-dir)')\n }\n return createDiskBacking(options.directory)\n }\n }\n}\n", "import S3rver from 's3rver'\n\nimport type { DappBacking } from './DappBacking.ts'\n\n/**\n * The bucket-per-role split of a dapp backend's layout. Path-style\n * addressing turns each bucket into a subfolder of the one origin \u2014\n * `/state`, `/data`, `/index`:\n *\n * - `data` \u2014 immutable, append-only facts (the source of truth)\n * - `state` \u2014 mutable current derived view, rebuilt by the DappActor\n * - `index` \u2014 query-optimized derived views, rebuilt by the DappActor\n */\nexport const DAPP_BUCKETS = ['state', 'data', 'index'] as const\nexport type DappBucket = typeof DAPP_BUCKETS[number]\n\nconst DEFAULT_HOST = '127.0.0.1'\nconst DEFAULT_PORT = 8801\n\n/** Allow browser dapp clients to read the layout cross-origin. */\nconst CORS_ALLOW_READS = `<CORSConfiguration>\n <CORSRule>\n <AllowedOrigin>*</AllowedOrigin>\n <AllowedMethod>GET</AllowedMethod>\n <AllowedMethod>HEAD</AllowedMethod>\n <AllowedHeader>*</AllowedHeader>\n </CORSRule>\n</CORSConfiguration>`\n\nexport interface DappServerOptions {\n backing: DappBacking\n host?: string\n port?: number\n publicHost?: string\n silent?: boolean\n tls?: {\n cert: string | Buffer\n key: string | Buffer\n }\n}\n\nexport interface RunningDappServer {\n baseUrl: string\n port: number\n close(): Promise<void>\n}\n\n/**\n * Boots an S3-compatible server (s3rver) pre-configured with the three dapp\n * layout buckets. Writers use the S3 API (any credentials are accepted);\n * readers fetch `/{bucket}/{layout-path}` over HTTP or optional TLS.\n *\n * DEV ONLY \u2014 this server is a local development fixture, not a production\n * dapp host. It intentionally skips the production concerns the datalake and\n * signing-pool planes carry (auth, metrics, durable multi-instance storage):\n * any S3 credentials are accepted and the only backing is an ephemeral temp\n * directory. Production dapps stay on real object storage (S3/R2) behind the\n * standard sub-domain layout.\n */\nexport async function startDappServer(options: DappServerOptions): Promise<RunningDappServer> {\n const host = options.host ?? DEFAULT_HOST\n const publicHost = options.publicHost ?? host\n await options.backing.prepare()\n const server = new S3rver({\n address: host,\n allowMismatchedSignatures: true,\n cert: options.tls?.cert,\n configureBuckets: DAPP_BUCKETS.map(name => ({ name, configs: [CORS_ALLOW_READS] })),\n directory: options.backing.directory,\n key: options.tls?.key,\n port: options.port ?? DEFAULT_PORT,\n silent: options.silent ?? false,\n vhostBuckets: false,\n })\n try {\n const { port } = await server.run()\n return {\n baseUrl: `${options.tls === undefined ? 'http' : 'https'}://${publicHost}:${port}`,\n port,\n close: async (): Promise<void> => {\n await server.close()\n await options.backing.cleanup()\n },\n }\n } catch (error) {\n await options.backing.cleanup()\n throw error\n }\n}\n"],
5
+ "mappings": ";AAAA,SAAS,iBAAiB;AAC1B,SAAS,SAAS,UAAU;AAC5B,SAAS,cAAc;AACvB,OAAO,UAAU;AAEV,IAAM,gBAAgB,CAAC,UAAU,MAAM;AAGvC,SAAS,kBAAkB,OAAyC;AACzE,SAAQ,cAAoC,SAAS,KAAK;AAC5D;AA4BO,SAAS,sBAAmC;AACjD,MAAI;AACJ,SAAO;AAAA,IACL,aAAa;AAAA,IACb,IAAI,YAAoB;AACtB,UAAI,QAAQ,OAAW,OAAM,IAAI,MAAM,6BAA6B;AACpE,aAAO;AAAA,IACT;AAAA,IACA,MAAM,UAAyB;AAC7B,cAAQ,MAAM,QAAQ,KAAK,KAAK,OAAO,GAAG,aAAa,CAAC;AAAA,IAC1D;AAAA,IACA,MAAM,UAAyB;AAC7B,UAAI,QAAQ,OAAW,OAAM,GAAG,KAAK,EAAE,WAAW,MAAM,OAAO,KAAK,CAAC;AACrE,YAAM;AAAA,IACR;AAAA,EACF;AACF;AAOO,SAAS,kBAAkB,WAAgC;AAChE,QAAM,WAAW,KAAK,QAAQ,SAAS;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;AAClC,WAAO;AAAA,MACL,SAAS,GAAG,QAAQ,QAAQ,SAAY,SAAS,OAAO,MAAM,UAAU,IAAI,IAAI;AAAA,MAChF;AAAA,MACA,OAAO,YAA2B;AAChC,cAAM,OAAO,MAAM;AACnB,cAAM,QAAQ,QAAQ,QAAQ;AAAA,MAChC;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,UAAM,QAAQ,QAAQ,QAAQ;AAC9B,UAAM;AAAA,EACR;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariestools/aries-dapp-serve",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Aries dapp REST server: serves a dapp backend's S3 layout from one origin with /state, /data, /index subfolders",
5
5
  "keywords": [
6
6
  "ariestools",
@@ -37,7 +37,7 @@
37
37
  "s3rver": "~3.7.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@ariestools/tsconfig": "~8.7.16",
40
+ "@ariestools/tsconfig": "~8.7.20",
41
41
  "@aws-sdk/client-s3": "~3.1090.0",
42
42
  "@types/node": "~26.1.1",
43
43
  "@types/s3rver": "~3.7.4",