@devvit/shared-types 0.11.20-next-2025-07-30-23-39-02-f472e0ba8.0 → 0.11.20-next-2025-07-31-16-39-01-d8b1781f8.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/PostData.d.ts +2 -2
- package/json.d.ts +12 -12
- package/package.json +5 -5
- package/schemas/config-file.v1.d.ts +11 -11
- package/schemas/config-file.v1.js +2 -2
package/PostData.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { JsonObject } from './json.js';
|
|
2
2
|
/**
|
|
3
3
|
* Post data included in the current post.
|
|
4
4
|
* This data is set at custom Post creation via `submitPost({ postData: {...} })` and can be updated via `Post.setPostData({...})`.
|
|
5
5
|
* If there is no post data specified, the value is undefined.
|
|
6
6
|
*/
|
|
7
|
-
export type PostData =
|
|
7
|
+
export type PostData = JsonObject;
|
|
8
8
|
//# sourceMappingURL=PostData.d.ts.map
|
package/json.d.ts
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
* @see https://github.com/microsoft/TypeScript/issues/1897
|
|
10
10
|
* @see https://www.json.org
|
|
11
11
|
*/
|
|
12
|
-
export type
|
|
13
|
-
export type
|
|
14
|
-
[key: string]:
|
|
12
|
+
export type JsonValue = JsonPrimitive | JsonArray | JsonObject;
|
|
13
|
+
export type JsonObject = {
|
|
14
|
+
[key: string]: JsonValue;
|
|
15
15
|
};
|
|
16
|
-
export type
|
|
17
|
-
export type
|
|
16
|
+
export type JsonArray = JsonValue[];
|
|
17
|
+
export type JsonPrimitive = boolean | null | number | string;
|
|
18
18
|
/**
|
|
19
|
-
* Like
|
|
19
|
+
* Like JsonValue but deeply allow lossy undefined values that are easier to
|
|
20
20
|
* type but may de/serialize differently or incorrectly. For example:
|
|
21
21
|
*
|
|
22
22
|
* - `JSON.stringify({a: 1, b: 2, c: undefined, d: 3})`: `'{"a":1,"b":2,"d":3}'`.
|
|
@@ -24,7 +24,7 @@ export type JSONPrimitive = boolean | null | number | string;
|
|
|
24
24
|
* - `JSON.stringify(undefined)`: `undefined`.
|
|
25
25
|
*
|
|
26
26
|
* JSON.stringify() accepts an `any` input so there are no typing guards. Prefer
|
|
27
|
-
* plain
|
|
27
|
+
* plain JsonValue when possible.
|
|
28
28
|
*
|
|
29
29
|
* One mostly only cares about stringify since creating a JSON string with
|
|
30
30
|
* undefineds in it would require deliberate effort. These all throw errors:
|
|
@@ -34,10 +34,10 @@ export type JSONPrimitive = boolean | null | number | string;
|
|
|
34
34
|
* - `JSON.parse('undefined')`.
|
|
35
35
|
* - `JSON.parse(undefined)` (also a typing error).
|
|
36
36
|
*/
|
|
37
|
-
export type
|
|
38
|
-
export type
|
|
39
|
-
[key: string]:
|
|
37
|
+
export type PartialJsonValue = PartialJsonPrimitive | PartialJsonArray | PartialJsonObject;
|
|
38
|
+
export type PartialJsonObject = Partial<{
|
|
39
|
+
[key: string]: PartialJsonValue;
|
|
40
40
|
}>;
|
|
41
|
-
export type
|
|
42
|
-
export type
|
|
41
|
+
export type PartialJsonArray = PartialJsonValue[];
|
|
42
|
+
export type PartialJsonPrimitive = boolean | null | number | string | undefined;
|
|
43
43
|
//# sourceMappingURL=json.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/shared-types",
|
|
3
|
-
"version": "0.11.20-next-2025-07-
|
|
3
|
+
"version": "0.11.20-next-2025-07-31-16-39-01-d8b1781f8.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
},
|
|
26
26
|
"types": "./index.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@devvit/protos": "0.11.20-next-2025-07-
|
|
28
|
+
"@devvit/protos": "0.11.20-next-2025-07-31-16-39-01-d8b1781f8.0",
|
|
29
29
|
"jsonschema": "1.4.1",
|
|
30
30
|
"uuid": "9.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@devvit/repo-tools": "0.11.20-next-2025-07-
|
|
34
|
-
"@devvit/tsconfig": "0.11.20-next-2025-07-
|
|
33
|
+
"@devvit/repo-tools": "0.11.20-next-2025-07-31-16-39-01-d8b1781f8.0",
|
|
34
|
+
"@devvit/tsconfig": "0.11.20-next-2025-07-31-16-39-01-d8b1781f8.0",
|
|
35
35
|
"@types/redis-mock": "0.17.1",
|
|
36
36
|
"@types/uuid": "9.0.0",
|
|
37
37
|
"chokidar-cli": "3.0.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"directory": "dist"
|
|
47
47
|
},
|
|
48
48
|
"source": "./src/index.ts",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "a22f4ae371c11088c2c95888b009a3bde094a0e5"
|
|
50
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Scope } from '@devvit/protos';
|
|
2
|
-
import type {
|
|
2
|
+
import type { JsonObject, JsonValue } from '../json.js';
|
|
3
3
|
/**
|
|
4
4
|
* devvit.json with defaults. See config-file.v1.json schema. Schema is assumed
|
|
5
5
|
* to be v1.
|
|
@@ -21,7 +21,7 @@ export type AppConfig = {
|
|
|
21
21
|
forms?: AppFormsConfig;
|
|
22
22
|
marketingAssets?: AppMarketingAssetsConfig;
|
|
23
23
|
/** The original config as parsed. Used for writebacks. */
|
|
24
|
-
json:
|
|
24
|
+
json: AppConfigJson;
|
|
25
25
|
};
|
|
26
26
|
export type AppBlocksConfig = {
|
|
27
27
|
entry: string;
|
|
@@ -118,13 +118,13 @@ export type AppSchedulerConfig = {
|
|
|
118
118
|
export type AppSchedulerTaskConfig = {
|
|
119
119
|
endpoint: string;
|
|
120
120
|
cron?: string;
|
|
121
|
-
data?:
|
|
121
|
+
data?: JsonObject;
|
|
122
122
|
};
|
|
123
123
|
/**
|
|
124
124
|
* https://transform.tools/json-schema-to-typescript
|
|
125
125
|
* @internal
|
|
126
126
|
*/
|
|
127
|
-
export type
|
|
127
|
+
export type AppConfigJson = {
|
|
128
128
|
$schema?: string;
|
|
129
129
|
name: string;
|
|
130
130
|
media?: {
|
|
@@ -148,8 +148,8 @@ export type AppConfigJSON = {
|
|
|
148
148
|
post?: {
|
|
149
149
|
dir?: string;
|
|
150
150
|
entrypoints?: {
|
|
151
|
-
[name: string]:
|
|
152
|
-
default:
|
|
151
|
+
[name: string]: AppPostEntrypointConfigJson;
|
|
152
|
+
default: AppPostEntrypointConfigJson;
|
|
153
153
|
};
|
|
154
154
|
};
|
|
155
155
|
server?: {
|
|
@@ -181,24 +181,24 @@ export type AppConfigJSON = {
|
|
|
181
181
|
dev?: {
|
|
182
182
|
subreddit?: string;
|
|
183
183
|
};
|
|
184
|
-
scheduler?:
|
|
184
|
+
scheduler?: AppSchedulerConfigJson;
|
|
185
185
|
marketingAssets?: {
|
|
186
186
|
icon?: string;
|
|
187
187
|
};
|
|
188
188
|
/** User data. */
|
|
189
|
-
[key: string]:
|
|
189
|
+
[key: string]: JsonValue;
|
|
190
190
|
};
|
|
191
|
-
export type
|
|
191
|
+
export type AppPostEntrypointConfigJson = {
|
|
192
192
|
entry: string;
|
|
193
193
|
height?: AppPostHeightConfig;
|
|
194
194
|
};
|
|
195
|
-
export type
|
|
195
|
+
export type AppSchedulerConfigJson = {
|
|
196
196
|
tasks: {
|
|
197
197
|
[name: string]: AppSchedulerTaskConfig | string;
|
|
198
198
|
};
|
|
199
199
|
};
|
|
200
200
|
export declare function parseAppConfig(str: string): AppConfig;
|
|
201
|
-
export declare function
|
|
201
|
+
export declare function parseAppConfigJson(json: JsonValue): AppConfig;
|
|
202
202
|
/** @internal */
|
|
203
203
|
export declare function validate(config: Readonly<AppConfig>): void;
|
|
204
204
|
//# sourceMappingURL=config-file.v1.d.ts.map
|
|
@@ -11,9 +11,9 @@ export function parseAppConfig(str) {
|
|
|
11
11
|
catch (err) {
|
|
12
12
|
throw Error(`cannot parse config JSON`, { cause: err });
|
|
13
13
|
}
|
|
14
|
-
return
|
|
14
|
+
return parseAppConfigJson(json);
|
|
15
15
|
}
|
|
16
|
-
export function
|
|
16
|
+
export function parseAppConfigJson(json) {
|
|
17
17
|
const ret = jsonschema.validate(json, schema);
|
|
18
18
|
if (!ret.valid)
|
|
19
19
|
throw new Error(ret.errors
|