@devvit/server 0.11.20-next-2025-08-11-22-16-06-b15a7c9c1.0 → 0.11.20-next-2025-08-12-00-07-21-b7c03d104.0

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/context.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ import type { Metadata } from '@devvit/protos';
1
2
  import type { Context } from './server-context.js';
3
+ export declare function getMetadata(): Readonly<Metadata> | undefined;
2
4
  /**
3
5
  * Runs an async callback with the given Context. Code in the callback can use
4
6
  * `getContext()` to get the context. For testing.
package/context.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAyBnD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEhG;AAED,eAAO,MAAM,OAAO,SAalB,CAAC;AAEH,iCAAiC;AACjC,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAMjE;AAED,iCAAiC;AACjC,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAM7D"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAyBnD,wBAAgB,WAAW,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,CAM5D;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEhG;AAED,eAAO,MAAM,OAAO,SAalB,CAAC;AAEH,iCAAiC;AACjC,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAMjE;AAED,iCAAiC;AACjC,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAM7D"}
package/context.js CHANGED
@@ -19,6 +19,13 @@ function getContext() {
19
19
  }
20
20
  return ctx;
21
21
  }
22
+ export function getMetadata() {
23
+ const ctx = requestContextStorage.getStore();
24
+ if (!ctx) {
25
+ return undefined;
26
+ }
27
+ return ctx.metadata;
28
+ }
22
29
  /**
23
30
  * Runs an async callback with the given Context. Code in the callback can use
24
31
  * `getContext()` to get the context. For testing.
@@ -1,4 +1,6 @@
1
1
  import type { IncomingMessage, Server, ServerOptions, ServerResponse } from 'node:http';
2
+ import type { Metadata } from '@devvit/protos';
3
+ import type { FormField } from '@devvit/shared';
2
4
  /**
3
5
  * Creates a new Devvit server. This implements the same API as Node.js's `createServer` function,
4
6
  * but we do not guarantee that this actually creates an HTTP server of any kind - it may be any
@@ -12,6 +14,13 @@ export declare const createServer: <Request extends typeof IncomingMessage = typ
12
14
  declare global {
13
15
  namespace globalThis {
14
16
  var enableWebbitBundlingHack: boolean;
17
+ var devvit: {
18
+ metadataProvider?: () => Readonly<Metadata> | undefined;
19
+ settings?: {
20
+ app?: FormField[] | undefined;
21
+ installation?: FormField[] | undefined;
22
+ };
23
+ };
15
24
  }
16
25
  }
17
26
  //# sourceMappingURL=create-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-server.d.ts","sourceRoot":"","sources":["../src/create-server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,aAAa,EAAE,cAA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CAAC,EAC1B,GAAG,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAG;IAAE,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,CAAA;CAAE,KACzD,GAAG,CAAC,EACb,kBAAkB,CAChB,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,EAC1B,GAAG,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAG;IAAE,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,CAAA;CAAE,KACzD,GAAG,KACP,MAAM,CAAC,OAAO,EAAE,QAAQ,CAM1B,CAAC;AA6CF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU,CAAC;QAEnB,IAAI,wBAAwB,EAAE,OAAO,CAAC;QAEtC,IAAI,MAAM,EAAE;YACV,gBAAgB,CAAC,EAAE,MAAM,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;YACxD,QAAQ,CAAC,EAAE;gBACT,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;gBAC9B,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;aACxC,CAAC;SACH,CAAC;KACH;CACF"}
package/create-server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import { createServer as nodeCreateServer } from 'node:http';
3
- import { runWithContext } from './context.js';
3
+ import { getMetadata, runWithContext } from './context.js';
4
4
  import { Context } from './server-context.js';
5
5
  /**
6
6
  * Creates a new Devvit server. This implements the same API as Node.js's `createServer` function,
@@ -14,6 +14,8 @@ export const createServer = (optionsOrRequestListener, requestListener) => {
14
14
  return _createServer(optionsOrRequestListener ?? {}, requestListener);
15
15
  };
16
16
  function _createServer(options, requestListener) {
17
+ globalThis.devvit ?? (globalThis.devvit = {});
18
+ globalThis.devvit.metadataProvider = getMetadata;
17
19
  const server = nodeCreateServer(options, async (req, res) => {
18
20
  const context = Context(req.headers);
19
21
  return runWithContext(context, async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvit/server",
3
- "version": "0.11.20-next-2025-08-11-22-16-06-b15a7c9c1.0",
3
+ "version": "0.11.20-next-2025-08-12-00-07-21-b7c03d104.0",
4
4
  "license": "BSD-3-Clause",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,18 +30,18 @@
30
30
  },
31
31
  "types": "./dist/index.d.ts",
32
32
  "dependencies": {
33
- "@devvit/protos": "0.11.20-next-2025-08-11-22-16-06-b15a7c9c1.0",
34
- "@devvit/public-api": "0.11.20-next-2025-08-11-22-16-06-b15a7c9c1.0",
35
- "@devvit/shared": "0.11.20-next-2025-08-11-22-16-06-b15a7c9c1.0",
36
- "@devvit/shared-types": "0.11.20-next-2025-08-11-22-16-06-b15a7c9c1.0"
33
+ "@devvit/protos": "0.11.20-next-2025-08-12-00-07-21-b7c03d104.0",
34
+ "@devvit/public-api": "0.11.20-next-2025-08-12-00-07-21-b7c03d104.0",
35
+ "@devvit/shared": "0.11.20-next-2025-08-12-00-07-21-b7c03d104.0",
36
+ "@devvit/shared-types": "0.11.20-next-2025-08-12-00-07-21-b7c03d104.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@devvit/repo-tools": "0.11.20-next-2025-08-11-22-16-06-b15a7c9c1.0",
40
- "@devvit/tsconfig": "0.11.20-next-2025-08-11-22-16-06-b15a7c9c1.0",
39
+ "@devvit/repo-tools": "0.11.20-next-2025-08-12-00-07-21-b7c03d104.0",
40
+ "@devvit/tsconfig": "0.11.20-next-2025-08-12-00-07-21-b7c03d104.0",
41
41
  "eslint": "9.11.1",
42
42
  "typescript": "5.8.3",
43
43
  "vitest": "1.6.1"
44
44
  },
45
45
  "source": "./src/index.ts",
46
- "gitHead": "fb3a4e1a7300f9666f1ead52f702d54d9d793c8c"
46
+ "gitHead": "2336d0ff378b3dc9460b268fd45534d8a80e94fb"
47
47
  }