@devvit/public-api 0.11.0-next-2024-08-05-2ed73e85a.0 → 0.11.0-next-2024-08-06-81c6947e7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/devvit/Devvit.d.ts +3 -10
- package/devvit/Devvit.d.ts.map +1 -1
- package/devvit/internals/app-settings.js +1 -1
- package/devvit/internals/blocks/BlocksTransformer.d.ts +3 -2
- package/devvit/internals/blocks/BlocksTransformer.d.ts.map +1 -1
- package/devvit/internals/blocks/BlocksTransformer.js +6 -4
- package/devvit/internals/blocks/handler/BlocksHandler.d.ts +2 -1
- package/devvit/internals/blocks/handler/BlocksHandler.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/BlocksHandler.js +6 -2
- package/devvit/internals/custom-post.js +3 -3
- package/devvit/internals/helpers/settingsUtils.js +3 -3
- package/devvit/internals/installation-settings.js +1 -1
- package/devvit/internals/menu-items.d.ts +1 -1
- package/devvit/internals/menu-items.d.ts.map +1 -1
- package/devvit/internals/menu-items.js +5 -5
- package/devvit/internals/ui-event-handler.js +7 -7
- package/devvit/internals/ui-request-handler.js +2 -2
- package/meta.json +20 -20
- package/meta.min.json +21 -21
- package/package.json +7 -7
- package/public-api.d.ts +2 -9
- package/public-api.iife.js +29 -24
- package/public-api.min.js +5 -5
- package/public-api.min.js.map +3 -3
package/devvit/Devvit.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Actor } from '@devvit/shared-types/Actor.js';
|
2
|
-
import type { JSONObject
|
2
|
+
import type { JSONObject } from '@devvit/shared-types/json.js';
|
3
3
|
import type { FormKey } from '@devvit/shared-types/useForm.js';
|
4
4
|
import type { BaseContext, Configuration, ContextAPIClients, CustomPostType, Form, FormFunction, FormOnSubmitEventHandler, FormToFormValues, IconName, MenuItem, MultiTriggerDefinition, ScheduledJobType, SettingsFormField, TriggerEvent, TriggerEventType, TriggerOnEventHandler } from '../types/index.js';
|
5
5
|
/**
|
@@ -352,15 +352,8 @@ export declare namespace Devvit {
|
|
352
352
|
*/
|
353
353
|
id?: string;
|
354
354
|
};
|
355
|
-
type
|
356
|
-
|
357
|
-
};
|
358
|
-
type OnMessageEvent = {
|
359
|
-
type: string;
|
360
|
-
data?: JSONValue;
|
361
|
-
};
|
362
|
-
type OnPressEventHandler = (event: OnPressEvent) => void | Promise<void>;
|
363
|
-
type OnWebViewEventHandler = (event: OnMessageEvent) => void | Promise<void>;
|
355
|
+
type OnPressEventHandler = (data: JSONObject) => void | Promise<void>;
|
356
|
+
type OnWebViewEventHandler = (message: JSONObject) => void | Promise<void>;
|
364
357
|
type Actionable = {
|
365
358
|
onPress?: OnPressEventHandler | undefined;
|
366
359
|
};
|
package/devvit/Devvit.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Devvit.d.ts","sourceRoot":"","sources":["../../src/devvit/Devvit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAItD,OAAO,KAAK,EAAE,UAAU,EAAE,
|
1
|
+
{"version":3,"file":"Devvit.d.ts","sourceRoot":"","sources":["../../src/devvit/Devvit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAItD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,IAAI,EAEJ,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,sBAAsB,EAGtB,gBAAgB,EAChB,iBAAiB,EAGjB,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AA4C3B;;;;;GAKG;AACH,KAAK,WAAW,GAAG;IACjB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEpC;;;OA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ED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,GAAG,CAAC,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAAC;IAEjD,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC;IAC9C,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;CACzB,CAAC;AAKF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAkB,SAAQ,MAAM,CAAC,MAAM,CAAC,iBAAiB;SAAG;QAEtE,KAAK,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACtC,KAAK,WAAW,GAAG,YAAY,GAAG,GAAG,CAAC,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;QAClF,KAAK,OAAO,GAAG,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;QAClD,KAAK,wBAAwB,GAAG;YAAE,QAAQ,EAAE,EAAE,CAAA;SAAE,CAAC;QACjD,KAAK,QAAQ,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;QAC5C,KAAK,KAAK,CAAC,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG;YAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,eAAe,CAAA;SAAE,CAAC;QAE1E,KAAK,iBAAiB,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,KAAK,GAAG,CAAC,OAAO,CAAC;KACrF;CACF"}
|
@@ -7,7 +7,7 @@ async function onGetSettingsFields() {
|
|
7
7
|
if (!Devvit.appSettings) {
|
8
8
|
throw new Error('App settings were not defined.');
|
9
9
|
}
|
10
|
-
return GetFieldsResponse.
|
10
|
+
return GetFieldsResponse.fromJSON({
|
11
11
|
fields: {
|
12
12
|
fields: transformFormFields(Devvit.appSettings),
|
13
13
|
},
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import type {
|
1
|
+
import type { BlockAction, BlockAlignment, BlockBorder, BlockColor, BlockConfig } from '@devvit/protos';
|
2
|
+
import type { Block } from '@devvit/protos';
|
2
3
|
import { BlockAnimationDirection, BlockAnimationLoopMode, BlockAnimationType, BlockAvatarBackground, BlockAvatarFacing, BlockAvatarSize, BlockButtonAppearance, BlockButtonSize, BlockFullSnooSize, BlockGap, BlockIconSize, BlockImageResizeMode, BlockPadding, BlockRadius, BlockSpacerShape, BlockSpacerSize, BlockStackDirection, BlockTextOutline, BlockTextOverflow, BlockTextSize, BlockTextStyle, BlockTextWeight, BlockType } from '@devvit/protos';
|
3
4
|
import { Devvit } from '../../Devvit.js';
|
4
5
|
import type { ReifiedBlockElement, ReifiedBlockElementOrLiteral } from './BlocksReconciler.js';
|
@@ -60,7 +61,7 @@ export declare class BlocksTransformer {
|
|
60
61
|
makeAnimation(props: Devvit.Blocks.AnimationProps | undefined, transformContext: TransformContext): Block | undefined;
|
61
62
|
makeWebView(props: Devvit.Blocks.WebViewProps | undefined, transformContext: TransformContext): Block | undefined;
|
62
63
|
makeBlock(type: BlockType, props: Devvit.Blocks.BaseProps | undefined, transformContext: TransformContext, config?: BlockConfig | undefined): Block;
|
63
|
-
ensureRootBlock(
|
64
|
+
ensureRootBlock(block: Block): Block;
|
64
65
|
}
|
65
66
|
export {};
|
66
67
|
//# sourceMappingURL=BlocksTransformer.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"BlocksTransformer.d.ts","sourceRoot":"","sources":["../../../../src/devvit/internals/blocks/BlocksTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
1
|
+
{"version":3,"file":"BlocksTransformer.d.ts","sourceRoot":"","sources":["../../../../src/devvit/internals/blocks/BlocksTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,W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YAAY,CACV,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,GAAG,SAAS,EAC9C,gBAAgB,EAAE,gBAAgB,GACjC,KAAK,GAAG,SAAS;IAapB,aAAa,CACX,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG,SAAS,EAC/C,gBAAgB,EAAE,gBAAgB,GACjC,KAAK,GAAG,SAAS;IAmBpB,WAAW,CACT,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,GAAG,SAAS,EAC7C,gBAAgB,EAAE,gBAAgB,GACjC,KAAK,GAAG,SAAS;IAYpB,SAAS,CACP,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,EAC1C,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,GAC/B,KAAK;IAWR,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;CAkBrC"}
|
@@ -651,15 +651,17 @@ export class BlocksTransformer {
|
|
651
651
|
key: props?.key,
|
652
652
|
};
|
653
653
|
}
|
654
|
-
ensureRootBlock(
|
655
|
-
|
654
|
+
ensureRootBlock(block) {
|
655
|
+
let root;
|
656
656
|
if (block.type === BlockType.BLOCK_ROOT) {
|
657
657
|
if (block.config?.rootConfig && Devvit.customPostType?.height) {
|
658
658
|
block.config.rootConfig.height = this.makeRootHeight(Devvit.customPostType?.height);
|
659
659
|
}
|
660
|
-
|
660
|
+
root = block;
|
661
|
+
}
|
662
|
+
else {
|
663
|
+
root = this.wrapRoot(undefined, [block]);
|
661
664
|
}
|
662
|
-
const root = this.wrapRoot(undefined, [block]);
|
663
665
|
if (!root) {
|
664
666
|
throw new Error('Could not create root block');
|
665
667
|
}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import type { UIResponse } from '@devvit/protos';
|
2
|
+
import { type Metadata, type UIRequest } from '@devvit/protos';
|
2
3
|
import type { EffectEmitter } from '../EffectEmitter.js';
|
3
4
|
import { RenderContext } from './RenderContext.js';
|
4
5
|
import type { Hook, HookParams, HookSegment } from './types.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"BlocksHandler.d.ts","sourceRoot":"","sources":["../../../../../src/devvit/internals/blocks/handler/BlocksHandler.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"BlocksHandler.d.ts","sourceRoot":"","sources":["../../../../../src/devvit/internals/blocks/handler/BlocksHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAe,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAgB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAe,IAAI,EAAE,UAAU,EAAE,WAAW,EAAS,MAAM,YAAY,CAAC;AAIpF;;;;;;GAMG;AACH,eAAO,IAAI,oBAAoB,EAAE,aAAa,GAAG,IAAW,CAAC;AAE7D,wBAAgB,gBAAgB,IAAI,aAAa,CAKhD;AAED,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CASxD;AASD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,IAAI,EACzC,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,CAAC,GAChC,CAAC,CAkCH;AAED,eAAO,IAAI,oBAAoB,EAAE,aAAa,GAAG,IAAW,CAAC;AAE7D;;;;GAIG;AACH,qBAAa,aAAa;;IAMxB,oBAAoB,EAAE,aAAa,GAAG,IAAI,CAAQ;gBAEtC,IAAI,EAAE,GAAG,CAAC,iBAAiB;IAMjC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CAoX1E"}
|
@@ -250,7 +250,7 @@ export class BlocksHandler {
|
|
250
250
|
return {
|
251
251
|
state: context._changedState,
|
252
252
|
effects: context.effects,
|
253
|
-
blocks,
|
253
|
+
blocks: blocks,
|
254
254
|
events: context._requeueEvents,
|
255
255
|
};
|
256
256
|
}
|
@@ -409,7 +409,11 @@ async function _BlocksHandler_handleAsyncQueues(context, ...batch) {
|
|
409
409
|
const hook = registerHook({
|
410
410
|
namespace: key,
|
411
411
|
key: false,
|
412
|
-
}, ({ hookId }) => ({
|
412
|
+
}, ({ hookId }) => ({
|
413
|
+
hookId,
|
414
|
+
state: null,
|
415
|
+
onUIEvent: (event) => props[key](event.userAction?.data),
|
416
|
+
}));
|
413
417
|
reifiedProps[key] = hook.hookId;
|
414
418
|
if ('captureHookRef' in props[key]) {
|
415
419
|
props[key].captureHookRef();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CustomPostDefinition } from '@devvit/protos';
|
1
|
+
import { CustomPostDefinition, RenderPostResponse } from '@devvit/protos';
|
2
2
|
import { Devvit } from '../Devvit.js';
|
3
3
|
import { BlocksReconciler } from './blocks/BlocksReconciler.js';
|
4
4
|
import { extendDevvitPrototype } from './helpers/extendDevvitPrototype.js';
|
@@ -9,13 +9,13 @@ async function renderPost(req, metadata) {
|
|
9
9
|
}
|
10
10
|
const reconciler = new BlocksReconciler((_props, context) => customPostType.render(context), req.blocks, req.state, metadata, req.dimensions);
|
11
11
|
const blocksUI = await reconciler.render();
|
12
|
-
return {
|
12
|
+
return RenderPostResponse.fromJSON({
|
13
13
|
state: reconciler.state,
|
14
14
|
blocks: {
|
15
15
|
ui: blocksUI,
|
16
16
|
},
|
17
17
|
effects: reconciler.getEffects(),
|
18
|
-
};
|
18
|
+
});
|
19
19
|
}
|
20
20
|
export function registerCustomPost(config) {
|
21
21
|
config.provides(CustomPostDefinition);
|
@@ -14,10 +14,10 @@ export async function onValidateFormHelper(req, settings, metadata) {
|
|
14
14
|
if (!settings) {
|
15
15
|
throw new Error('Settings were not defined.');
|
16
16
|
}
|
17
|
-
const response =
|
17
|
+
const response = {
|
18
18
|
success: true,
|
19
19
|
errors: {},
|
20
|
-
}
|
20
|
+
};
|
21
21
|
const formValues = getFormValues(req.fieldValues);
|
22
22
|
const flattendFields = extractSettingsFields(settings);
|
23
23
|
await Promise.all(flattendFields.map(async (field) => {
|
@@ -39,5 +39,5 @@ export async function onValidateFormHelper(req, settings, metadata) {
|
|
39
39
|
}
|
40
40
|
}
|
41
41
|
}));
|
42
|
-
return response;
|
42
|
+
return ValidateFormResponse.fromJSON(response);
|
43
43
|
}
|
@@ -7,7 +7,7 @@ async function onGetSettingsFields() {
|
|
7
7
|
if (!Devvit.installationSettings) {
|
8
8
|
throw new Error('Installation settings were not defined.');
|
9
9
|
}
|
10
|
-
return GetFieldsResponse.
|
10
|
+
return GetFieldsResponse.fromJSON({
|
11
11
|
fields: {
|
12
12
|
fields: transformFormFields(Devvit.installationSettings),
|
13
13
|
},
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Config } from '@devvit/shared-types/Config.js';
|
2
|
-
import type { MenuItem } from '../../types/
|
2
|
+
import type { MenuItem } from '../../types/index.js';
|
3
3
|
export declare function getMenuItemById(id: string): MenuItem | undefined;
|
4
4
|
export declare function registerMenuItems(config: Config): void;
|
5
5
|
//# sourceMappingURL=menu-items.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"menu-items.d.ts","sourceRoot":"","sources":["../../../src/devvit/internals/menu-items.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"menu-items.d.ts","sourceRoot":"","sources":["../../../src/devvit/internals/menu-items.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAI7D,OAAO,KAAK,EAAE,QAAQ,EAAwB,MAAM,sBAAsB,CAAC;AAU3E,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAEhE;AA4ED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAItD"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ContextActionDefinition,
|
1
|
+
import { ContextActionDefinition, ContextActionList, ContextActionResponse } from '@devvit/protos';
|
2
2
|
import { assertNonNull } from '@devvit/shared-types/NonNull.js';
|
3
3
|
import { makeAPIClients } from '../../apis/makeAPIClients.js';
|
4
4
|
import { getEffectsFromUIClient } from '../../apis/ui/helpers/getEffectsFromUIClient.js';
|
@@ -18,7 +18,7 @@ async function getActions(_, _metadata) {
|
|
18
18
|
throw new Error('No menu items registered.');
|
19
19
|
}
|
20
20
|
const actions = menuItems.map((item, index) => {
|
21
|
-
return
|
21
|
+
return {
|
22
22
|
actionId: getActionId(index),
|
23
23
|
name: item.label,
|
24
24
|
description: item.description,
|
@@ -33,9 +33,9 @@ async function getActions(_, _metadata) {
|
|
33
33
|
moderator: item.forUserType?.includes('moderator'),
|
34
34
|
},
|
35
35
|
postFilters: item.postFilter === 'currentApp' ? { currentApp: true } : undefined,
|
36
|
-
}
|
36
|
+
};
|
37
37
|
});
|
38
|
-
return { actions };
|
38
|
+
return ContextActionList.fromJSON({ actions });
|
39
39
|
}
|
40
40
|
async function onAction(req, metadata) {
|
41
41
|
const menuItem = getMenuItemById(req.actionId);
|
@@ -61,7 +61,7 @@ async function onAction(req, metadata) {
|
|
61
61
|
},
|
62
62
|
});
|
63
63
|
await menuItem.onPress(event, context);
|
64
|
-
return ContextActionResponse.
|
64
|
+
return ContextActionResponse.fromJSON({
|
65
65
|
effects: getEffectsFromUIClient(context.ui),
|
66
66
|
});
|
67
67
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { EffectType, UIEventHandlerDefinition } from '@devvit/protos';
|
1
|
+
import { EffectType, HandleUIEventResponse, UIEventHandlerDefinition } from '@devvit/protos';
|
2
2
|
import cloneDeep from 'clone-deep';
|
3
3
|
import isEqual from 'lodash.isequal';
|
4
4
|
import { makeAPIClients } from '../../apis/makeAPIClients.js';
|
@@ -24,10 +24,10 @@ async function handleUIEvent(req, metadata) {
|
|
24
24
|
if (Devvit.customPostType) {
|
25
25
|
const blocksReconciler = new BlocksReconciler((_props, context) => Devvit.customPostType?.render(context) ?? null, req.event, req.state, metadata, undefined);
|
26
26
|
await blocksReconciler.reconcile();
|
27
|
-
return {
|
27
|
+
return HandleUIEventResponse.fromJSON({
|
28
28
|
state: blocksReconciler.state,
|
29
29
|
effects: blocksReconciler.getEffects(),
|
30
|
-
};
|
30
|
+
});
|
31
31
|
}
|
32
32
|
}
|
33
33
|
const formDefinition = Devvit.formDefinitions.get(formKey);
|
@@ -60,10 +60,10 @@ async function handleUIEvent(req, metadata) {
|
|
60
60
|
if (Devvit.customPostType) {
|
61
61
|
const blocksReconciler = new BlocksReconciler((_props, context) => Devvit.customPostType?.render(context) ?? null, req.event, req.state, metadata, undefined);
|
62
62
|
await blocksReconciler.reconcile();
|
63
|
-
return {
|
63
|
+
return HandleUIEventResponse.fromJSON({
|
64
64
|
state: blocksReconciler.state,
|
65
65
|
effects: blocksReconciler.getEffects(),
|
66
|
-
};
|
66
|
+
});
|
67
67
|
}
|
68
68
|
}
|
69
69
|
else if (req.event?.toastAction) {
|
@@ -83,10 +83,10 @@ async function handleUIEvent(req, metadata) {
|
|
83
83
|
},
|
84
84
|
]
|
85
85
|
: uiEffects;
|
86
|
-
return {
|
86
|
+
return HandleUIEventResponse.fromJSON({
|
87
87
|
state,
|
88
88
|
effects,
|
89
|
-
};
|
89
|
+
});
|
90
90
|
}
|
91
91
|
export function registerUIEventHandler(config) {
|
92
92
|
config.provides(UIEventHandlerDefinition);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CustomPostDefinition } from '@devvit/protos';
|
1
|
+
import { CustomPostDefinition, UIResponse } from '@devvit/protos';
|
2
2
|
import { Devvit } from '../Devvit.js';
|
3
3
|
import { BlocksHandler } from './blocks/handler/BlocksHandler.js';
|
4
4
|
import { extendDevvitPrototype } from './helpers/extendDevvitPrototype.js';
|
@@ -15,7 +15,7 @@ const UIComponentBindings = [
|
|
15
15
|
function makeHandler(component) {
|
16
16
|
return async (req, metadata) => {
|
17
17
|
const handler = new BlocksHandler(component);
|
18
|
-
return handler.handle(req, metadata);
|
18
|
+
return UIResponse.fromJSON(handler.handle(req, metadata));
|
19
19
|
};
|
20
20
|
}
|
21
21
|
export function registerUIRequestHandlers(config) {
|
package/meta.json
CHANGED
@@ -11698,7 +11698,7 @@
|
|
11698
11698
|
"format": "esm"
|
11699
11699
|
},
|
11700
11700
|
"src/devvit/internals/helpers/settingsUtils.ts": {
|
11701
|
-
"bytes":
|
11701
|
+
"bytes": 2092,
|
11702
11702
|
"imports": [
|
11703
11703
|
{
|
11704
11704
|
"path": "../protos/dist/index.js",
|
@@ -11724,7 +11724,7 @@
|
|
11724
11724
|
"format": "esm"
|
11725
11725
|
},
|
11726
11726
|
"src/devvit/internals/app-settings.ts": {
|
11727
|
-
"bytes":
|
11727
|
+
"bytes": 1186,
|
11728
11728
|
"imports": [
|
11729
11729
|
{
|
11730
11730
|
"path": "../protos/dist/index.js",
|
@@ -11803,7 +11803,7 @@
|
|
11803
11803
|
"format": "esm"
|
11804
11804
|
},
|
11805
11805
|
"src/devvit/internals/blocks/BlocksTransformer.ts": {
|
11806
|
-
"bytes":
|
11806
|
+
"bytes": 27614,
|
11807
11807
|
"imports": [
|
11808
11808
|
{
|
11809
11809
|
"path": "../protos/dist/index.js",
|
@@ -11890,7 +11890,7 @@
|
|
11890
11890
|
"format": "esm"
|
11891
11891
|
},
|
11892
11892
|
"src/devvit/internals/custom-post.ts": {
|
11893
|
-
"bytes":
|
11893
|
+
"bytes": 1239,
|
11894
11894
|
"imports": [
|
11895
11895
|
{
|
11896
11896
|
"path": "../protos/dist/index.js",
|
@@ -11916,7 +11916,7 @@
|
|
11916
11916
|
"format": "esm"
|
11917
11917
|
},
|
11918
11918
|
"src/devvit/internals/installation-settings.ts": {
|
11919
|
-
"bytes":
|
11919
|
+
"bytes": 1243,
|
11920
11920
|
"imports": [
|
11921
11921
|
{
|
11922
11922
|
"path": "../protos/dist/index.js",
|
@@ -11947,7 +11947,7 @@
|
|
11947
11947
|
"format": "esm"
|
11948
11948
|
},
|
11949
11949
|
"src/devvit/internals/menu-items.ts": {
|
11950
|
-
"bytes":
|
11950
|
+
"bytes": 3423,
|
11951
11951
|
"imports": [
|
11952
11952
|
{
|
11953
11953
|
"path": "../protos/dist/index.js",
|
@@ -12133,7 +12133,7 @@
|
|
12133
12133
|
"format": "cjs"
|
12134
12134
|
},
|
12135
12135
|
"src/devvit/internals/ui-event-handler.ts": {
|
12136
|
-
"bytes":
|
12136
|
+
"bytes": 4276,
|
12137
12137
|
"imports": [
|
12138
12138
|
{
|
12139
12139
|
"path": "../protos/dist/index.js",
|
@@ -12509,7 +12509,7 @@
|
|
12509
12509
|
"format": "esm"
|
12510
12510
|
},
|
12511
12511
|
"src/devvit/internals/blocks/handler/BlocksHandler.ts": {
|
12512
|
-
"bytes":
|
12512
|
+
"bytes": 18389,
|
12513
12513
|
"imports": [
|
12514
12514
|
{
|
12515
12515
|
"path": "@devvit/protos",
|
@@ -12550,7 +12550,7 @@
|
|
12550
12550
|
"format": "esm"
|
12551
12551
|
},
|
12552
12552
|
"src/devvit/internals/ui-request-handler.ts": {
|
12553
|
-
"bytes":
|
12553
|
+
"bytes": 1267,
|
12554
12554
|
"imports": [
|
12555
12555
|
{
|
12556
12556
|
"path": "../protos/dist/index.js",
|
@@ -12576,7 +12576,7 @@
|
|
12576
12576
|
"format": "esm"
|
12577
12577
|
},
|
12578
12578
|
"src/devvit/Devvit.ts": {
|
12579
|
-
"bytes":
|
12579
|
+
"bytes": 34942,
|
12580
12580
|
"imports": [
|
12581
12581
|
{
|
12582
12582
|
"path": "../protos/dist/index.js",
|
@@ -14358,10 +14358,10 @@
|
|
14358
14358
|
"bytesInOutput": 1679
|
14359
14359
|
},
|
14360
14360
|
"src/devvit/internals/helpers/settingsUtils.ts": {
|
14361
|
-
"bytesInOutput":
|
14361
|
+
"bytesInOutput": 1316
|
14362
14362
|
},
|
14363
14363
|
"src/devvit/internals/app-settings.ts": {
|
14364
|
-
"bytesInOutput":
|
14364
|
+
"bytesInOutput": 611
|
14365
14365
|
},
|
14366
14366
|
"src/apis/ui/helpers/getEffectsFromUIClient.ts": {
|
14367
14367
|
"bytesInOutput": 69
|
@@ -14382,19 +14382,19 @@
|
|
14382
14382
|
"bytesInOutput": 2353
|
14383
14383
|
},
|
14384
14384
|
"src/devvit/internals/blocks/BlocksTransformer.ts": {
|
14385
|
-
"bytesInOutput":
|
14385
|
+
"bytesInOutput": 21969
|
14386
14386
|
},
|
14387
14387
|
"src/devvit/internals/blocks/BlocksReconciler.ts": {
|
14388
14388
|
"bytesInOutput": 14150
|
14389
14389
|
},
|
14390
14390
|
"src/devvit/internals/custom-post.ts": {
|
14391
|
-
"bytesInOutput":
|
14391
|
+
"bytesInOutput": 726
|
14392
14392
|
},
|
14393
14393
|
"src/devvit/internals/installation-settings.ts": {
|
14394
|
-
"bytesInOutput":
|
14394
|
+
"bytesInOutput": 663
|
14395
14395
|
},
|
14396
14396
|
"src/devvit/internals/menu-items.ts": {
|
14397
|
-
"bytesInOutput":
|
14397
|
+
"bytesInOutput": 2383
|
14398
14398
|
},
|
14399
14399
|
"src/devvit/internals/plugins.ts": {
|
14400
14400
|
"bytesInOutput": 173
|
@@ -14409,7 +14409,7 @@
|
|
14409
14409
|
"bytesInOutput": 5667
|
14410
14410
|
},
|
14411
14411
|
"src/devvit/internals/ui-event-handler.ts": {
|
14412
|
-
"bytesInOutput":
|
14412
|
+
"bytesInOutput": 3181
|
14413
14413
|
},
|
14414
14414
|
"../shared-types/dist/useForm.js": {
|
14415
14415
|
"bytesInOutput": 162
|
@@ -14451,10 +14451,10 @@
|
|
14451
14451
|
"bytesInOutput": 1362
|
14452
14452
|
},
|
14453
14453
|
"src/devvit/internals/blocks/handler/BlocksHandler.ts": {
|
14454
|
-
"bytesInOutput":
|
14454
|
+
"bytesInOutput": 14625
|
14455
14455
|
},
|
14456
14456
|
"src/devvit/internals/ui-request-handler.ts": {
|
14457
|
-
"bytesInOutput":
|
14457
|
+
"bytesInOutput": 639
|
14458
14458
|
},
|
14459
14459
|
"src/devvit/Devvit.ts": {
|
14460
14460
|
"bytesInOutput": 18680
|
@@ -14535,7 +14535,7 @@
|
|
14535
14535
|
"bytesInOutput": 370
|
14536
14536
|
}
|
14537
14537
|
},
|
14538
|
-
"bytes":
|
14538
|
+
"bytes": 14799051
|
14539
14539
|
}
|
14540
14540
|
}
|
14541
14541
|
}
|