@devvit/public-api 0.10.22-next-2024-06-10-ff8c2ccde.0 → 0.10.22-next-2024-06-10-e3193479b.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,24 +1,28 @@
1
1
  import { Actor } from '@devvit/shared-types/Actor.js';
2
2
  import type { BaseContext, Configuration, ContextAPIClients, CustomPostType, Data, Form, FormFunction, FormKey, FormOnSubmitEventHandler, IconName, MenuItem, MultiTriggerDefinition, ScheduledJobType, SettingsFormField, TriggerEvent, TriggerEventType, TriggerOnEventHandler } from '../types/index.js';
3
- export declare class Devvit extends Actor {
4
- #private;
3
+ /**
4
+ * Home for debug flags, settings, and other information. Any type removals
5
+ * may cause type errors but not runtime errors.
6
+ *
7
+ * **Favor ContextDebugInfo since request-based state is preferred.**
8
+ */
9
+ type DevvitDebug = {
5
10
  /**
6
- * Home for debug flags, settings, and other information.
11
+ * Should debug block rendering in console.log according to the reified JSX/XML output. Example:
12
+ *
13
+ * <hstack><text>hi world</text></hstack>
14
+ *
7
15
  */
8
- static debug: {
9
- /**
10
- * Should debug block rendering in console.log according to the reified JSX/XML output. Example:
11
- *
12
- * <hstack><text>hi world</text></hstack>
13
- *
14
- */
15
- emitSnapshots: boolean;
16
- /**
17
- * Should console.log the state of the app after every event.
18
- *
19
- */
20
- emitState: boolean;
21
- };
16
+ emitSnapshots?: boolean | undefined;
17
+ /**
18
+ * Should console.log the state of the app after every event.
19
+ *
20
+ */
21
+ emitState?: boolean | undefined;
22
+ };
23
+ export declare class Devvit extends Actor {
24
+ #private;
25
+ static debug: DevvitDebug;
22
26
  /**
23
27
  * To use certain APIs and features of Devvit, you must enable them using this function.
24
28
  *
@@ -477,4 +481,5 @@ declare global {
477
481
  type ComponentFunction = (props: JSX.Props, context: Devvit.Context) => JSX.Element;
478
482
  }
479
483
  }
484
+ export {};
480
485
  //# sourceMappingURL=Devvit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Devvit.d.ts","sourceRoot":"","sources":["../../src/devvit/Devvit.ts"],"names":[],"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G,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"}
package/devvit/Devvit.js CHANGED
@@ -433,23 +433,7 @@ _a = Devvit, _Devvit_use = function _Devvit_use(d, opts) {
433
433
  __classPrivateFieldGet(this, _a, "f", _Devvit_pluginClients)[d.fullName] = wrapped;
434
434
  return wrapped;
435
435
  };
436
- /**
437
- * Home for debug flags, settings, and other information.
438
- */
439
- Devvit.debug = {
440
- /**
441
- * Should debug block rendering in console.log according to the reified JSX/XML output. Example:
442
- *
443
- * <hstack><text>hi world</text></hstack>
444
- *
445
- */
446
- emitSnapshots: false,
447
- /**
448
- * Should console.log the state of the app after every event.
449
- *
450
- */
451
- emitState: false,
452
- };
436
+ Devvit.debug = {};
453
437
  _Devvit_configuration = { value: {} };
454
438
  _Devvit_menuItems = { value: [] };
455
439
  _Devvit_customPostType = { value: void 0 };
@@ -155,9 +155,10 @@ export class BlocksReconciler {
155
155
  return uniqueId;
156
156
  }
157
157
  async reconcile() {
158
+ const ctx = __classPrivateFieldGet(this, _BlocksReconciler_instances, "m", _BlocksReconciler_makeContextProps).call(this);
158
159
  const blockElement = {
159
160
  type: this.component,
160
- props: __classPrivateFieldGet(this, _BlocksReconciler_instances, "m", _BlocksReconciler_makeContextProps).call(this),
161
+ props: ctx,
161
162
  children: [],
162
163
  };
163
164
  const reified = await this.processBlock(blockElement);
@@ -176,23 +177,22 @@ export class BlocksReconciler {
176
177
  __classPrivateFieldGet(this, _BlocksReconciler_instances, "m", _BlocksReconciler_reset).call(this);
177
178
  }
178
179
  async buildBlocksUI() {
180
+ const ctx = __classPrivateFieldGet(this, _BlocksReconciler_instances, "m", _BlocksReconciler_makeContextProps).call(this);
179
181
  const rootBlockElement = {
180
182
  type: this.component,
181
- props: __classPrivateFieldGet(this, _BlocksReconciler_instances, "m", _BlocksReconciler_makeContextProps).call(this),
183
+ props: ctx,
182
184
  children: [],
183
185
  };
184
- const block = await this.renderElement(rootBlockElement);
186
+ const block = await this.renderElement(ctx, rootBlockElement);
185
187
  return this.transformer.ensureRootBlock(block);
186
188
  }
187
- async renderElement(element) {
189
+ async renderElement(ctx, element) {
188
190
  const reified = await this.processBlock(element);
189
191
  assertNotString(reified);
190
- if (Devvit.debug.emitSnapshots || this.metadata[Header.DebugRenderXML]?.values[0]) {
191
- console.log(indentXML(toXML(reified)));
192
- }
193
- if (Devvit.debug.emitState) {
194
- console.log(JSON.stringify(this.state, null, 2));
195
- }
192
+ if (Devvit.debug.emitSnapshots || ctx.debug.emitSnapshots)
193
+ console.debug(indentXML(toXML(reified)));
194
+ if (Devvit.debug.emitState || ctx.debug.emitState)
195
+ console.debug(JSON.stringify(this.state, undefined, 2));
196
196
  return this.transformer.createBlocksElementOrThrow(reified);
197
197
  }
198
198
  async processProps(block) {
@@ -1 +1 @@
1
- {"version":3,"file":"BlocksHandler.d.ts","sourceRoot":"","sources":["../../../../../src/devvit/internals/blocks/handler/BlocksHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAM7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,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CAErC;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,IAAI,EACzC,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,CAAC,GAChC,CAAC,CA8BH;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;CA2U1E"}
@@ -1,15 +1,15 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
1
6
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
7
  if (kind === "m") throw new TypeError("Private method is not writable");
3
8
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
10
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
11
  };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _BlocksHandler_instances, _BlocksHandler_root, _BlocksHandler_contextBuilder, _BlocksHandler_blocksTransformer, _BlocksHandler_loadHooks, _BlocksHandler_handleAsyncQueues, _BlocksHandler_attemptHook, _BlocksHandler_handleMainQueue, _BlocksHandler_renderRoot, _BlocksHandler_render, _BlocksHandler_renderList, _BlocksHandler_renderElement, _BlocksHandler_reifyProps;
12
+ var _BlocksHandler_instances, _BlocksHandler_root, _BlocksHandler_contextBuilder, _BlocksHandler_blocksTransformer, _BlocksHandler_debug_get, _BlocksHandler_loadHooks, _BlocksHandler_handleAsyncQueues, _BlocksHandler_attemptHook, _BlocksHandler_handleMainQueue, _BlocksHandler_renderRoot, _BlocksHandler_render, _BlocksHandler_renderList, _BlocksHandler_renderElement, _BlocksHandler_reifyProps;
13
13
  import isEqual from 'lodash.isequal';
14
14
  import { BlocksTransformer } from '../BlocksTransformer.js';
15
15
  import { ContextBuilder } from './ContextBuilder.js';
@@ -87,7 +87,8 @@ export class BlocksHandler {
87
87
  _BlocksHandler_contextBuilder.set(this, new ContextBuilder());
88
88
  _BlocksHandler_blocksTransformer.set(this, new BlocksTransformer(() => this._latestRenderContext?.devvitContext?.assets));
89
89
  this._latestRenderContext = null;
90
- console.log('BlocksHandler v1');
90
+ if (__classPrivateFieldGet(this, _BlocksHandler_instances, "a", _BlocksHandler_debug_get))
91
+ console.debug('[blocks] BlocksHandler v1');
91
92
  __classPrivateFieldSet(this, _BlocksHandler_root, root, "f");
92
93
  _latestBlocksHandler = this;
93
94
  }
@@ -112,9 +113,11 @@ export class BlocksHandler {
112
113
  let changed;
113
114
  let progress;
114
115
  let remaining = [...eventsToProcess];
115
- console.debug('starting processing events');
116
+ if (__classPrivateFieldGet(this, _BlocksHandler_instances, "a", _BlocksHandler_debug_get))
117
+ console.debug('[blocks] starting processing events');
116
118
  while (eventsToProcess.length > 0) {
117
- console.debug('processing events loop iteration', eventsToProcess.length);
119
+ if (__classPrivateFieldGet(this, _BlocksHandler_instances, "a", _BlocksHandler_debug_get))
120
+ console.debug('[blocks] processing events loop iteration', eventsToProcess.length);
118
121
  /**
119
122
  * A concurrently executable batch is a set of events that can be executed in parallel. This either one main queue event,
120
123
  * or any number of other queue events.
@@ -142,7 +145,8 @@ export class BlocksHandler {
142
145
  }
143
146
  }
144
147
  catch (e) {
145
- console.debug('caught in handler', e);
148
+ if (__classPrivateFieldGet(this, _BlocksHandler_instances, "a", _BlocksHandler_debug_get))
149
+ console.debug('[blocks] caught in handler', e);
146
150
  /**
147
151
  * If we have a progress, we can recover from an error by rolling back to the last progress, and then letting the
148
152
  * remaining events be reprocessed.
@@ -163,24 +167,28 @@ export class BlocksHandler {
163
167
  throw e;
164
168
  }
165
169
  }
166
- console.debug('remaining events', context._requeueEvents);
170
+ if (__classPrivateFieldGet(this, _BlocksHandler_instances, "a", _BlocksHandler_debug_get))
171
+ console.debug('[blocks] remaining events', context._requeueEvents);
167
172
  const remainingRequeueEvents = [];
168
173
  for (const event of context._requeueEvents) {
169
174
  if (!isMainQueue && !event.async) {
170
- console.debug('NOT reprocessing event in BlocksHandler, sync mismatch A', event);
175
+ if (__classPrivateFieldGet(this, _BlocksHandler_instances, "a", _BlocksHandler_debug_get))
176
+ console.debug('[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A', event);
171
177
  // We're async, this is a main qrueue event. We need to send it back to the platform to let
172
178
  // the platform synchronize it.
173
179
  remainingRequeueEvents.push(event);
174
180
  continue;
175
181
  }
176
182
  if (isMainQueue && event.async && !isBlockingSSR) {
177
- console.debug('NOT reprocessing event in BlocksHandler, sync mismatch B', event);
183
+ if (__classPrivateFieldGet(this, _BlocksHandler_instances, "a", _BlocksHandler_debug_get))
184
+ console.debug('[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B', event);
178
185
  // We're main queue, and this is an async event. We're not in SSR mode, so let's prioritize
179
186
  // returning control quickly to the platform so we don't block event loops.
180
187
  remainingRequeueEvents.push(event);
181
188
  continue;
182
189
  }
183
- console.debug('reprocessing event in BlocksHandler', event);
190
+ if (__classPrivateFieldGet(this, _BlocksHandler_instances, "a", _BlocksHandler_debug_get))
191
+ console.debug('[blocks] reprocessing event in BlocksHandler', event);
184
192
  eventsToProcess.push(event);
185
193
  }
186
194
  context._requeueEvents = remainingRequeueEvents; //
@@ -209,13 +217,13 @@ export class BlocksHandler {
209
217
  * TODO: hide this behind a flag, because it's possibly expensive.
210
218
  */
211
219
  if (!isEqual(context._state, stateCopy)) {
212
- console.error('State was mutated during rendering', context._state, stateCopy);
220
+ console.error('[blocks] State was mutated during rendering', context._state, stateCopy);
213
221
  }
214
222
  if (!isEqual(context._requeueEvents, eventsCopy)) {
215
- console.error('Events were mutated during rendering', context._requeueEvents, eventsCopy);
223
+ console.error('[blocks] Events were mutated during rendering', context._requeueEvents, eventsCopy);
216
224
  }
217
225
  if (!isEqual(context._effects, effectsCopy)) {
218
- console.error('Effects were mutated during rendering', context._effects, effectsCopy);
226
+ console.error('[blocks] Effects were mutated during rendering', context._effects, effectsCopy);
219
227
  }
220
228
  if (tags) {
221
229
  blocks = __classPrivateFieldGet(this, _BlocksHandler_blocksTransformer, "f").createBlocksElementOrThrow(tags);
@@ -230,7 +238,9 @@ export class BlocksHandler {
230
238
  };
231
239
  }
232
240
  }
233
- _BlocksHandler_root = new WeakMap(), _BlocksHandler_contextBuilder = new WeakMap(), _BlocksHandler_blocksTransformer = new WeakMap(), _BlocksHandler_instances = new WeakSet(), _BlocksHandler_loadHooks = function _BlocksHandler_loadHooks(context, ..._events) {
241
+ _BlocksHandler_root = new WeakMap(), _BlocksHandler_contextBuilder = new WeakMap(), _BlocksHandler_blocksTransformer = new WeakMap(), _BlocksHandler_instances = new WeakSet(), _BlocksHandler_debug_get = function _BlocksHandler_debug_get() {
242
+ return !!this._latestRenderContext?.devvitContext.debug.blocks;
243
+ }, _BlocksHandler_loadHooks = function _BlocksHandler_loadHooks(context, ..._events) {
234
244
  // TBD: partial rendering
235
245
  context._hooks = {};
236
246
  __classPrivateFieldGet(this, _BlocksHandler_instances, "m", _BlocksHandler_renderRoot).call(this, __classPrivateFieldGet(this, _BlocksHandler_root, "f"), context.request.props ?? {}, context);
@@ -263,16 +273,20 @@ async function _BlocksHandler_handleAsyncQueues(context, ...batch) {
263
273
  }, _BlocksHandler_handleMainQueue = async function _BlocksHandler_handleMainQueue(context, ...batch) {
264
274
  // We need to handle events in order, so that the state is updated in the correct order.
265
275
  for (const event of batch) {
266
- console.log('handling main queue event', event);
267
- console.log('before', context._state);
276
+ if (__classPrivateFieldGet(this, _BlocksHandler_instances, "a", _BlocksHandler_debug_get))
277
+ console.log('[blocks] handling main queue event', event);
278
+ if (__classPrivateFieldGet(this, _BlocksHandler_instances, "a", _BlocksHandler_debug_get))
279
+ console.log('[blocks] before', context._state);
268
280
  __classPrivateFieldGet(this, _BlocksHandler_instances, "m", _BlocksHandler_loadHooks).call(this, context, event);
269
281
  await __classPrivateFieldGet(this, _BlocksHandler_instances, "m", _BlocksHandler_attemptHook).call(this, context, event);
270
- console.log('after', context._state);
282
+ if (__classPrivateFieldGet(this, _BlocksHandler_instances, "a", _BlocksHandler_debug_get))
283
+ console.log('[blocks] after', context._state);
271
284
  }
272
285
  // TODO: Decide whether this is excessive. It doesn't hurt anything besides performance.
273
286
  __classPrivateFieldGet(this, _BlocksHandler_instances, "m", _BlocksHandler_loadHooks).call(this, context);
274
287
  }, _BlocksHandler_renderRoot = function _BlocksHandler_renderRoot(component, props, context) {
275
- console.debug('renderRoot');
288
+ if (__classPrivateFieldGet(this, _BlocksHandler_instances, "a", _BlocksHandler_debug_get))
289
+ console.debug('[blocks] renderRoot');
276
290
  context._generated = {};
277
291
  _activeRenderContext = context;
278
292
  this._latestRenderContext = context;
@@ -98,7 +98,8 @@ export class RenderContext {
98
98
  * Adds event that will re-enter the dispatcher queue.
99
99
  */
100
100
  addToRequeueEvents(...events) {
101
- console.debug('requeueing events', events);
101
+ if (this._devvitContext?.debug.blocks)
102
+ console.debug('[blocks] requeueing events', events);
102
103
  const grouped = events.reduce((acc, event) => {
103
104
  if (event.retry) {
104
105
  acc.retry.push(event);
@@ -1 +1 @@
1
- {"version":3,"file":"useAsync.d.ts","sourceRoot":"","sources":["../../../../../src/devvit/internals/blocks/handler/useAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAQ3F,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAsGF;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,EAC1C,WAAW,EAAE,wBAAwB,CAAC,CAAC,CAAC,EACxC,OAAO,GAAE,YAAiB,GACzB,cAAc,CAAC,CAAC,CAAC,CAMnB"}
1
+ {"version":3,"file":"useAsync.d.ts","sourceRoot":"","sources":["../../../../../src/devvit/internals/blocks/handler/useAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAQ3F,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAuGF;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,EAC1C,WAAW,EAAE,wBAAwB,CAAC,CAAC,CAAC,EACxC,OAAO,GAAE,YAAiB,GACzB,cAAc,CAAC,CAAC,CAAC,CAMnB"}
@@ -9,21 +9,22 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _AsyncHook_hookId, _AsyncHook_initializer, _AsyncHook_invalidate, _AsyncHook_ctx, _AsyncHook_options, _AsyncHook_localDepends, _AsyncHook_enabled;
13
- import { registerHook } from './BlocksHandler.js';
14
- import isEqual from 'lodash.isequal';
12
+ var _AsyncHook_debug, _AsyncHook_hookId, _AsyncHook_initializer, _AsyncHook_invalidate, _AsyncHook_ctx, _AsyncHook_localDepends, _AsyncHook_enabled;
15
13
  import { CIRCUIT_BREAKER_MSG } from '@devvit/shared-types/CircuitBreaker.js';
14
+ import isEqual from 'lodash.isequal';
15
+ import { registerHook } from './BlocksHandler.js';
16
16
  class AsyncHook {
17
17
  constructor(initializer, options, params) {
18
+ _AsyncHook_debug.set(this, void 0);
18
19
  _AsyncHook_hookId.set(this, void 0);
19
20
  _AsyncHook_initializer.set(this, void 0);
20
21
  _AsyncHook_invalidate.set(this, void 0);
21
22
  _AsyncHook_ctx.set(this, void 0);
22
- _AsyncHook_options.set(this, void 0);
23
23
  _AsyncHook_localDepends.set(this, void 0);
24
24
  _AsyncHook_enabled.set(this, void 0);
25
- console.debug('useAsync v1', options);
26
- __classPrivateFieldSet(this, _AsyncHook_options, options, "f");
25
+ __classPrivateFieldSet(this, _AsyncHook_debug, !!params.context.devvitContext.debug.useAsync, "f");
26
+ if (__classPrivateFieldGet(this, _AsyncHook_debug, "f"))
27
+ console.debug('[useAsync] v1', options);
27
28
  this.state = { data: null, loading: false, error: null, depends: null };
28
29
  __classPrivateFieldSet(this, _AsyncHook_hookId, params.hookId, "f");
29
30
  __classPrivateFieldSet(this, _AsyncHook_initializer, initializer, "f");
@@ -39,8 +40,10 @@ class AsyncHook {
39
40
  if (!__classPrivateFieldGet(this, _AsyncHook_enabled, "f")) {
40
41
  return;
41
42
  }
42
- console.debug('async onLoad ', __classPrivateFieldGet(this, _AsyncHook_hookId, "f"), this.state);
43
- console.debug('async onLoad have ', __classPrivateFieldGet(this, _AsyncHook_localDepends, "f"), 'and', this.state.depends);
43
+ if (__classPrivateFieldGet(this, _AsyncHook_debug, "f"))
44
+ console.debug('[useAsync] async onLoad ', __classPrivateFieldGet(this, _AsyncHook_hookId, "f"), this.state);
45
+ if (__classPrivateFieldGet(this, _AsyncHook_debug, "f"))
46
+ console.debug('[useAsync] async onLoad have ', __classPrivateFieldGet(this, _AsyncHook_localDepends, "f"), 'and', this.state.depends);
44
47
  if (!isEqual(__classPrivateFieldGet(this, _AsyncHook_localDepends, "f"), this.state.depends) ||
45
48
  (this.state.data === null && this.state.error === null && this.state.loading === false)) {
46
49
  this.state.loading = true;
@@ -53,7 +56,8 @@ class AsyncHook {
53
56
  requestId: __classPrivateFieldGet(this, _AsyncHook_hookId, "f") + '-' + JSON.stringify(this.state.depends),
54
57
  },
55
58
  };
56
- console.debug('onLoad requeue');
59
+ if (__classPrivateFieldGet(this, _AsyncHook_debug, "f"))
60
+ console.debug('[useAsync] onLoad requeue');
57
61
  __classPrivateFieldGet(this, _AsyncHook_ctx, "f").addToRequeueEvents(requeueEvent);
58
62
  }
59
63
  }
@@ -86,7 +90,8 @@ class AsyncHook {
86
90
  asyncResponse: asyncResponse,
87
91
  hook: __classPrivateFieldGet(this, _AsyncHook_hookId, "f"),
88
92
  };
89
- console.debug('onReq requeue');
93
+ if (__classPrivateFieldGet(this, _AsyncHook_debug, "f"))
94
+ console.debug('[useAsync] onReq requeue');
90
95
  context.addToRequeueEvents(requeueEvent);
91
96
  }
92
97
  else if (event.asyncResponse) {
@@ -101,7 +106,8 @@ class AsyncHook {
101
106
  __classPrivateFieldGet(this, _AsyncHook_invalidate, "f").call(this);
102
107
  }
103
108
  else {
104
- console.debug('onResp skip, stale event');
109
+ if (__classPrivateFieldGet(this, _AsyncHook_debug, "f"))
110
+ console.debug('[useAsync] onResp skip, stale event');
105
111
  }
106
112
  }
107
113
  else {
@@ -109,7 +115,7 @@ class AsyncHook {
109
115
  }
110
116
  }
111
117
  }
112
- _AsyncHook_hookId = new WeakMap(), _AsyncHook_initializer = new WeakMap(), _AsyncHook_invalidate = new WeakMap(), _AsyncHook_ctx = new WeakMap(), _AsyncHook_options = new WeakMap(), _AsyncHook_localDepends = new WeakMap(), _AsyncHook_enabled = new WeakMap();
118
+ _AsyncHook_debug = new WeakMap(), _AsyncHook_hookId = new WeakMap(), _AsyncHook_initializer = new WeakMap(), _AsyncHook_invalidate = new WeakMap(), _AsyncHook_ctx = new WeakMap(), _AsyncHook_localDepends = new WeakMap(), _AsyncHook_enabled = new WeakMap();
113
119
  /**
114
120
  * This is the preferred way to handle async state in Devvit.
115
121
  *
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/devvit/internals/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,QAAQ,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,GACjB,WAAW,CA4Bb"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/devvit/internals/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI/C,OAAO,KAAK,EAAE,WAAW,EAAoB,MAAM,wBAAwB,CAAC;AAE5E,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,QAAQ,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,GACjB,WAAW,CA4Bb"}
@@ -6,7 +6,7 @@ export function getContextFromMetadata(metadata, postId, commentId) {
6
6
  const appAccountId = metadata[Header.AppUser]?.values[0];
7
7
  assertNonNull(appAccountId, 'appAccountId is missing from Context');
8
8
  const userId = metadata[Header.User]?.values[0];
9
- const debug = { metadata };
9
+ const debug = parseDebug(metadata);
10
10
  return {
11
11
  appAccountId,
12
12
  subredditId,
@@ -26,3 +26,40 @@ export function getContextFromMetadata(metadata, postId, commentId) {
26
26
  },
27
27
  };
28
28
  }
29
+ /** @internal */
30
+ export function parseDebug(meta) {
31
+ // Roughly aligns to initDevvitGlobal() except an empty devvit-debug doesn't
32
+ // enable all.
33
+ var _a;
34
+ // All known AppDebug keys.
35
+ const keyset = {
36
+ blocks: undefined,
37
+ emitSnapshots: undefined,
38
+ emitState: undefined,
39
+ runtime: undefined,
40
+ surface: undefined,
41
+ useAsync: undefined,
42
+ useChannel: undefined,
43
+ };
44
+ // {[key: Lowercase<AppDebug>]: AppDebug}
45
+ const lowerKeyToKey = {};
46
+ for (const key in keyset)
47
+ lowerKeyToKey[key.toLowerCase()] = key;
48
+ const debug = { metadata: meta };
49
+ // hack: gRPC-web header values don't split in compute. always join then split
50
+ // for parity in both local and remote runtimes.
51
+ for (const kv of (meta[Header.Debug]?.values ?? []).join().split(',')) {
52
+ let [key, val] = kv.split('=');
53
+ if (!key)
54
+ continue;
55
+ key = key.trim();
56
+ val = val?.trim();
57
+ if (key.toLowerCase() in lowerKeyToKey)
58
+ key = lowerKeyToKey[key.toLowerCase()];
59
+ else
60
+ console.warn(`[api] unknown devvit-debug header "${key}"`);
61
+ debug[_a = key] ?? (debug[_a] = val || `${true}`);
62
+ console.info(`[api] set devvit-debug ${key}=${debug[key]}`);
63
+ }
64
+ return debug;
65
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.test.d.ts","sourceRoot":"","sources":["../../../src/devvit/internals/context.test.ts"],"names":[],"mappings":""}
package/meta.json CHANGED
@@ -11190,7 +11190,7 @@
11190
11190
  "format": "esm"
11191
11191
  },
11192
11192
  "src/types/context.ts": {
11193
- "bytes": 4965,
11193
+ "bytes": 5559,
11194
11194
  "imports": [],
11195
11195
  "format": "esm"
11196
11196
  },
@@ -11368,7 +11368,7 @@
11368
11368
  "format": "esm"
11369
11369
  },
11370
11370
  "../shared-types/dist/Header.js": {
11371
- "bytes": 961,
11371
+ "bytes": 1800,
11372
11372
  "imports": [],
11373
11373
  "format": "esm"
11374
11374
  },
@@ -11760,7 +11760,7 @@
11760
11760
  "format": "esm"
11761
11761
  },
11762
11762
  "src/devvit/internals/context.ts": {
11763
- "bytes": 990,
11763
+ "bytes": 2390,
11764
11764
  "imports": [
11765
11765
  {
11766
11766
  "path": "../shared-types/dist/Header.js",
@@ -11885,7 +11885,7 @@
11885
11885
  "format": "esm"
11886
11886
  },
11887
11887
  "src/devvit/internals/blocks/BlocksReconciler.ts": {
11888
- "bytes": 18195,
11888
+ "bytes": 18194,
11889
11889
  "imports": [
11890
11890
  {
11891
11891
  "path": "../protos/dist/index.js",
@@ -12328,7 +12328,7 @@
12328
12328
  "format": "esm"
12329
12329
  },
12330
12330
  "src/devvit/internals/blocks/handler/RenderContext.ts": {
12331
- "bytes": 5447,
12331
+ "bytes": 5495,
12332
12332
  "imports": [
12333
12333
  {
12334
12334
  "path": "<runtime>",
@@ -12477,7 +12477,7 @@
12477
12477
  "format": "esm"
12478
12478
  },
12479
12479
  "src/devvit/internals/blocks/handler/BlocksHandler.ts": {
12480
- "bytes": 15102,
12480
+ "bytes": 15738,
12481
12481
  "imports": [
12482
12482
  {
12483
12483
  "path": "@devvit/protos",
@@ -12544,7 +12544,7 @@
12544
12544
  "format": "esm"
12545
12545
  },
12546
12546
  "src/devvit/Devvit.ts": {
12547
- "bytes": 33892,
12547
+ "bytes": 34066,
12548
12548
  "imports": [
12549
12549
  {
12550
12550
  "path": "../protos/dist/index.js",
@@ -13311,12 +13311,12 @@
13311
13311
  "format": "esm"
13312
13312
  },
13313
13313
  "src/devvit/internals/blocks/handler/useAsync.ts": {
13314
- "bytes": 4653,
13314
+ "bytes": 4856,
13315
13315
  "imports": [
13316
13316
  {
13317
- "path": "src/devvit/internals/blocks/handler/BlocksHandler.ts",
13317
+ "path": "../shared-types/dist/CircuitBreaker.js",
13318
13318
  "kind": "import-statement",
13319
- "original": "./BlocksHandler.js"
13319
+ "original": "@devvit/shared-types/CircuitBreaker.js"
13320
13320
  },
13321
13321
  {
13322
13322
  "path": "../../node_modules/lodash.isequal/index.js",
@@ -13324,9 +13324,9 @@
13324
13324
  "original": "lodash.isequal"
13325
13325
  },
13326
13326
  {
13327
- "path": "../shared-types/dist/CircuitBreaker.js",
13327
+ "path": "src/devvit/internals/blocks/handler/BlocksHandler.ts",
13328
13328
  "kind": "import-statement",
13329
- "original": "@devvit/shared-types/CircuitBreaker.js"
13329
+ "original": "./BlocksHandler.js"
13330
13330
  },
13331
13331
  {
13332
13332
  "path": "<runtime>",
@@ -14290,7 +14290,7 @@
14290
14290
  "bytesInOutput": 86
14291
14291
  },
14292
14292
  "../shared-types/dist/Header.js": {
14293
- "bytesInOutput": 841
14293
+ "bytesInOutput": 1185
14294
14294
  },
14295
14295
  "src/devvit/internals/blocks/useChannel.ts": {
14296
14296
  "bytesInOutput": 3627
@@ -14347,7 +14347,7 @@
14347
14347
  "bytesInOutput": 1973
14348
14348
  },
14349
14349
  "src/devvit/internals/context.ts": {
14350
- "bytesInOutput": 711
14350
+ "bytesInOutput": 1611
14351
14351
  },
14352
14352
  "src/devvit/internals/helpers/settingsUtils.ts": {
14353
14353
  "bytesInOutput": 1229
@@ -14371,7 +14371,7 @@
14371
14371
  "bytesInOutput": 22616
14372
14372
  },
14373
14373
  "src/devvit/internals/blocks/BlocksReconciler.ts": {
14374
- "bytesInOutput": 14171
14374
+ "bytesInOutput": 14129
14375
14375
  },
14376
14376
  "src/devvit/internals/custom-post.ts": {
14377
14377
  "bytesInOutput": 697
@@ -14398,7 +14398,7 @@
14398
14398
  "bytesInOutput": 3085
14399
14399
  },
14400
14400
  "src/devvit/internals/blocks/handler/BlocksHandler.ts": {
14401
- "bytesInOutput": 12588
14401
+ "bytesInOutput": 13730
14402
14402
  },
14403
14403
  "src/devvit/internals/blocks/handler/useForm.ts": {
14404
14404
  "bytesInOutput": 915
@@ -14410,7 +14410,7 @@
14410
14410
  "bytesInOutput": 2808
14411
14411
  },
14412
14412
  "src/devvit/internals/blocks/handler/RenderContext.ts": {
14413
- "bytesInOutput": 4082
14413
+ "bytesInOutput": 4138
14414
14414
  },
14415
14415
  "src/devvit/internals/blocks/handler/useInterval.ts": {
14416
14416
  "bytesInOutput": 2357
@@ -14428,7 +14428,7 @@
14428
14428
  "bytesInOutput": 618
14429
14429
  },
14430
14430
  "src/devvit/Devvit.ts": {
14431
- "bytesInOutput": 19173
14431
+ "bytesInOutput": 18780
14432
14432
  },
14433
14433
  "src/apis/reddit/helpers/makeGettersEnumerable.ts": {
14434
14434
  "bytesInOutput": 344
@@ -14505,14 +14505,14 @@
14505
14505
  "src/apis/ui/helpers/svg.ts": {
14506
14506
  "bytesInOutput": 370
14507
14507
  },
14508
- "src/devvit/internals/blocks/handler/useAsync.ts": {
14509
- "bytesInOutput": 4060
14510
- },
14511
14508
  "../shared-types/dist/CircuitBreaker.js": {
14512
14509
  "bytesInOutput": 50
14510
+ },
14511
+ "src/devvit/internals/blocks/handler/useAsync.ts": {
14512
+ "bytesInOutput": 4405
14513
14513
  }
14514
14514
  },
14515
- "bytes": 14942813
14515
+ "bytes": 14951471
14516
14516
  }
14517
14517
  }
14518
14518
  }