@devvit/server 0.11.20-next-2025-07-25-00-00-20-b42f98f6e.0 → 0.11.20-next-2025-07-28-12-50-32-fb5e880af.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,13 +1,15 @@
1
1
  import type { RequestContext } from './request-context.js';
2
2
  /**
3
3
  * Runs an async callback with the given RequestContext. Code in the callback can use
4
- * `getContext()` to get the context.
5
- * @internal
4
+ * `getContext()` to get the context. For testing.
5
+ * @experimental
6
6
  * @param context The context to run the callback with
7
7
  * @param callback The callback to run
8
8
  */
9
9
  export declare function runWithContext<T>(context: RequestContext, callback: () => Promise<T>): Promise<T>;
10
10
  export declare const context: RequestContext;
11
+ /** For testing. @experimental */
11
12
  export declare function setContextCache(key: string, value: unknown): void;
13
+ /** For testing. @experimental */
12
14
  export declare function getContextCache<T>(key: string): T | undefined;
13
15
  //# sourceMappingURL=context.d.ts.map
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,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAyB3D;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACpC,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACzB,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED,eAAO,MAAM,OAAO,gBAalB,CAAC;AAEH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAMjE;AAED,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,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAyB3D;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACpC,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACzB,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED,eAAO,MAAM,OAAO,gBAalB,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
@@ -21,8 +21,8 @@ function getContext() {
21
21
  }
22
22
  /**
23
23
  * Runs an async callback with the given RequestContext. Code in the callback can use
24
- * `getContext()` to get the context.
25
- * @internal
24
+ * `getContext()` to get the context. For testing.
25
+ * @experimental
26
26
  * @param context The context to run the callback with
27
27
  * @param callback The callback to run
28
28
  */
@@ -43,6 +43,7 @@ export const context = new Proxy({}, {
43
43
  return { enumerable: true, configurable: true, value: getContext()[key] };
44
44
  },
45
45
  });
46
+ /** For testing. @experimental */
46
47
  export function setContextCache(key, value) {
47
48
  const context = getContext();
48
49
  if (!context.cache) {
@@ -50,6 +51,7 @@ export function setContextCache(key, value) {
50
51
  }
51
52
  context.cache[key] = value;
52
53
  }
54
+ /** For testing. @experimental */
53
55
  export function getContextCache(key) {
54
56
  const context = getContext();
55
57
  if (!context.cache) {
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { context } from './context.js';
1
+ export { context, getContextCache, runWithContext, setContextCache } from './context.js';
2
2
  export { createServer } from './create-server.js';
3
3
  export { getServerPort } from './get-server-port.js';
4
4
  export { RequestContext, setRequestContext } from './request-context.js';
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { context } from './context.js';
1
+ export { context, getContextCache, runWithContext, setContextCache } from './context.js';
2
2
  export { createServer } from './create-server.js';
3
3
  export { getServerPort } from './get-server-port.js';
4
4
  export { RequestContext, setRequestContext } from './request-context.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvit/server",
3
- "version": "0.11.20-next-2025-07-25-00-00-20-b42f98f6e.0",
3
+ "version": "0.11.20-next-2025-07-28-12-50-32-fb5e880af.0",
4
4
  "license": "BSD-3-Clause",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,14 +23,14 @@
23
23
  },
24
24
  "types": "./index.d.ts",
25
25
  "dependencies": {
26
- "@devvit/protos": "0.11.20-next-2025-07-25-00-00-20-b42f98f6e.0",
27
- "@devvit/public-api": "0.11.20-next-2025-07-25-00-00-20-b42f98f6e.0",
28
- "@devvit/shared": "0.11.20-next-2025-07-25-00-00-20-b42f98f6e.0",
29
- "@devvit/shared-types": "0.11.20-next-2025-07-25-00-00-20-b42f98f6e.0"
26
+ "@devvit/protos": "0.11.20-next-2025-07-28-12-50-32-fb5e880af.0",
27
+ "@devvit/public-api": "0.11.20-next-2025-07-28-12-50-32-fb5e880af.0",
28
+ "@devvit/shared": "0.11.20-next-2025-07-28-12-50-32-fb5e880af.0",
29
+ "@devvit/shared-types": "0.11.20-next-2025-07-28-12-50-32-fb5e880af.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@devvit/repo-tools": "0.11.20-next-2025-07-25-00-00-20-b42f98f6e.0",
33
- "@devvit/tsconfig": "0.11.20-next-2025-07-25-00-00-20-b42f98f6e.0",
32
+ "@devvit/repo-tools": "0.11.20-next-2025-07-28-12-50-32-fb5e880af.0",
33
+ "@devvit/tsconfig": "0.11.20-next-2025-07-28-12-50-32-fb5e880af.0",
34
34
  "eslint": "9.11.1",
35
35
  "typescript": "5.8.3",
36
36
  "vitest": "1.6.1"
@@ -39,5 +39,5 @@
39
39
  "directory": "dist"
40
40
  },
41
41
  "source": "./src/index.ts",
42
- "gitHead": "8343dda7b00e1649f7864d562f442e26956f0c50"
42
+ "gitHead": "ea8c67f0f877eafc8b41e537fe6758d22d7db8b6"
43
43
  }
@@ -1,7 +0,0 @@
1
- import type { Config } from '@devvit/shared-types/Config.js';
2
- /**
3
- * Gets the Config object that the runtime drops on globalThis. For internal use only.
4
- * @internal
5
- */
6
- export declare function getDevvitConfig(): Config;
7
- //# sourceMappingURL=get-devvit-config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-devvit-config.d.ts","sourceRoot":"","sources":["../src/get-devvit-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAQxC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * Gets the Config object that the runtime drops on globalThis. For internal use only.
3
- * @internal
4
- */
5
- export function getDevvitConfig() {
6
- const config = globalThis?.devvit?.config;
7
- if (!config) {
8
- throw new Error('Devvit config is not available. Make sure to call getDevvitConfig() after the Devvit runtime has been initialized.');
9
- }
10
- return config;
11
- }