@plasmicapp/data-sources 1.0.3 → 1.0.4

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/dist/index.d.ts CHANGED
@@ -189,7 +189,7 @@ declare interface QueryDataProviderNode {
189
189
  children: QueryNode[];
190
190
  }
191
191
 
192
- declare interface QueryExecutionContext {
192
+ export declare interface QueryExecutionContext {
193
193
  $props: Record<string, unknown>;
194
194
  $ctx: Record<string, unknown>;
195
195
  $state: Record<string, unknown>;
package/dist/index.esm.js CHANGED
@@ -17,6 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
20
21
  var __async = (__this, __arguments, generator) => {
21
22
  return new Promise((resolve, reject) => {
22
23
  var fulfilled = (value) => {
@@ -283,7 +284,9 @@ function createDollarQueries(queryNames) {
283
284
  }
284
285
  var StatefulQueryResult = class {
285
286
  constructor() {
286
- this.listeners = /* @__PURE__ */ new Set();
287
+ __publicField(this, "current");
288
+ __publicField(this, "settable");
289
+ __publicField(this, "listeners", /* @__PURE__ */ new Set());
287
290
  this.current = { state: "initial", key: null };
288
291
  this.settable = new SettablePromise();
289
292
  tagPlasmicUndefinedDataErrorPromise(this.settable.promise);
@@ -429,8 +432,8 @@ function resolveParams(params) {
429
432
  function wrapDollarQueriesForMetadata($queries, ifUndefined, ifError) {
430
433
  return wrapDollarQueriesWithFallbacks(
431
434
  $queries,
432
- ifUndefined != null ? ifUndefined : () => "\u2026",
433
- ifError != null ? ifError : () => "[ERROR]"
435
+ ifUndefined != null ? ifUndefined : (() => "\u2026"),
436
+ ifError != null ? ifError : (() => "[ERROR]")
434
437
  );
435
438
  }
436
439
  function wrapDollarQueriesWithFallbacks($queries, ifUndefined, ifError) {
@@ -441,9 +444,9 @@ function wrapDollarQueriesWithFallbacks($queries, ifUndefined, ifError) {
441
444
  }
442
445
  var FallbackQueryResult = class {
443
446
  constructor($query, ifUndefined, ifError) {
444
- this.$query = $query;
445
- this.ifUndefined = ifUndefined;
446
- this.ifError = ifError;
447
+ __publicField(this, "$query", $query);
448
+ __publicField(this, "ifUndefined", ifUndefined);
449
+ __publicField(this, "ifError", ifError);
447
450
  }
448
451
  get key() {
449
452
  return this.$query.key;
@@ -472,8 +475,8 @@ function createConstantProxy(constant) {
472
475
  }
473
476
  var SyncPromise = class {
474
477
  constructor(promise) {
475
- this.promise = promise;
476
- this.result = void 0;
478
+ __publicField(this, "promise", promise);
479
+ __publicField(this, "result");
477
480
  promise.then(
478
481
  (value) => {
479
482
  this.result = {
@@ -505,6 +508,9 @@ function shallowEqualRecords(a, b) {
505
508
  }
506
509
  var SettablePromise = class {
507
510
  constructor() {
511
+ __publicField(this, "promise");
512
+ __publicField(this, "_resolve");
513
+ __publicField(this, "_reject");
508
514
  this.promise = new Promise((resolve, reject) => {
509
515
  this._resolve = resolve;
510
516
  this._reject = reject;
@@ -658,7 +664,7 @@ function usePlasmicQueries(tree, $props, $ctx, $state) {
658
664
  }
659
665
  }
660
666
  let cleanup = false;
661
- const loop = () => __async(this, null, function* () {
667
+ const loop = () => __async(null, null, function* () {
662
668
  while (true) {
663
669
  initPlasmicQueriesSync(
664
670
  $queryStates,
@@ -1211,7 +1217,7 @@ function makeCacheKey(dataOp, opts) {
1211
1217
  }
1212
1218
  function usePlasmicInvalidate() {
1213
1219
  const { cache, fallback, mutate } = usePlasmicDataConfig3();
1214
- return (invalidatedKeys) => __async(this, null, function* () {
1220
+ return (invalidatedKeys) => __async(null, null, function* () {
1215
1221
  const getKeysToInvalidate = () => {
1216
1222
  var _a, _b;
1217
1223
  if (!invalidatedKeys) {
@@ -1249,7 +1255,7 @@ function usePlasmicInvalidate() {
1249
1255
  if (keys.length === 0) {
1250
1256
  return;
1251
1257
  }
1252
- const invalidateKey = (key) => __async(this, null, function* () {
1258
+ const invalidateKey = (key) => __async(null, null, function* () {
1253
1259
  const studioInvalidate = globalThis.__PLASMIC_MUTATE_DATA_OP;
1254
1260
  if (studioInvalidate) {
1255
1261
  yield studioInvalidate(key);
@@ -1305,8 +1311,8 @@ function usePlasmicDataOp(dataOp, opts) {
1305
1311
  function usePlasmicDataMutationOp(dataOp) {
1306
1312
  const ctx = usePlasmicDataSourceContext();
1307
1313
  const userToken = ctx == null ? void 0 : ctx.userAuthToken;
1308
- const getRealDataOp = React4.useCallback(() => __async(this, null, function* () {
1309
- const tryGetRealDataOp = () => __async(this, null, function* () {
1314
+ const getRealDataOp = React4.useCallback(() => __async(null, null, function* () {
1315
+ const tryGetRealDataOp = () => __async(null, null, function* () {
1310
1316
  const resolved = resolveDataOp(dataOp);
1311
1317
  if (!resolved) {
1312
1318
  return null;
@@ -1319,7 +1325,7 @@ function usePlasmicDataMutationOp(dataOp) {
1319
1325
  });
1320
1326
  return yield tryGetRealDataOp();
1321
1327
  }), [dataOp]);
1322
- return React4.useCallback(() => __async(this, null, function* () {
1328
+ return React4.useCallback(() => __async(null, null, function* () {
1323
1329
  var _a;
1324
1330
  const { sourceId, opId, userArgs } = (_a = yield getRealDataOp()) != null ? _a : {};
1325
1331
  if (!sourceId || !opId) {