@plasmicapp/data-sources 1.0.4 → 1.0.6

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
@@ -325,6 +325,8 @@ export declare interface TableSchema {
325
325
  fields: TableFieldSchema[];
326
326
  }
327
327
 
328
+ export declare function throwIfPlasmicUndefinedDataError(err: unknown): void;
329
+
328
330
  /**
329
331
  * Executes all queries from a serialized component tree and returns query results.
330
332
  *
package/dist/index.esm.js CHANGED
@@ -39,62 +39,6 @@ var __async = (__this, __arguments, generator) => {
39
39
  });
40
40
  };
41
41
 
42
- // src/serverQueries/client.ts
43
- import {
44
- useMutablePlasmicQueryData as useMutablePlasmicQueryData2,
45
- usePlasmicDataConfig as usePlasmicDataConfig2,
46
- wrapLoadingFetcher
47
- } from "@plasmicapp/query";
48
- import * as React3 from "react";
49
-
50
- // src/utils.ts
51
- function noopFn() {
52
- }
53
- function pick(obj, ...keys) {
54
- const res = {};
55
- for (const key of keys) {
56
- if (key in obj) {
57
- res[key] = obj[key];
58
- }
59
- }
60
- return res;
61
- }
62
- var tuple = (...args) => args;
63
- function mkIdMap(xs) {
64
- return new Map(xs.map((x) => tuple(x.id, x)));
65
- }
66
- function notNil(x) {
67
- return x !== null && x !== void 0;
68
- }
69
- function withoutNils(xs) {
70
- return xs.filter(notNil);
71
- }
72
- function mapRecordEntries(callback, record1, record2, record3) {
73
- return Object.entries(record1).map(([k, v1]) => {
74
- const v2 = record2 == null ? void 0 : record2[k];
75
- const v3 = record3 == null ? void 0 : record3[k];
76
- return callback(
77
- k,
78
- v1,
79
- v2,
80
- v3
81
- );
82
- });
83
- }
84
- function mapRecords(callback, record1, record2, record3) {
85
- return Object.fromEntries(
86
- mapRecordEntries(
87
- (k, v1, v2, v3) => [k, callback(k, v1, v2, v3)],
88
- record1,
89
- record2,
90
- record3
91
- )
92
- );
93
- }
94
-
95
- // src/serverQueries/common.ts
96
- import React2 from "react";
97
-
98
42
  // src/common.ts
99
43
  import {
100
44
  useMutablePlasmicQueryData,
@@ -105,6 +49,11 @@ import React from "react";
105
49
  function isPlasmicUndefinedDataErrorPromise(x) {
106
50
  return !!x && typeof x === "object" && (x == null ? void 0 : x.plasmicType) === "PlasmicUndefinedDataError";
107
51
  }
52
+ function throwIfPlasmicUndefinedDataError(err) {
53
+ if (isPlasmicUndefinedDataErrorPromise(err)) {
54
+ throw err;
55
+ }
56
+ }
108
57
  function tagPlasmicUndefinedDataErrorPromise(promise) {
109
58
  promise.plasmicType = "PlasmicUndefinedDataError";
110
59
  promise.message = "Query is not done";
@@ -274,7 +223,61 @@ function usePlasmicFetch(key, resolvedParams, fetcherFn, resultMapper, undefined
274
223
  ]);
275
224
  }
276
225
 
226
+ // src/serverQueries/client.ts
227
+ import {
228
+ useMutablePlasmicQueryData as useMutablePlasmicQueryData2,
229
+ usePlasmicDataConfig as usePlasmicDataConfig2,
230
+ wrapLoadingFetcher
231
+ } from "@plasmicapp/query";
232
+ import * as React3 from "react";
233
+
234
+ // src/utils.ts
235
+ function noopFn() {
236
+ }
237
+ function pick(obj, ...keys) {
238
+ const res = {};
239
+ for (const key of keys) {
240
+ if (key in obj) {
241
+ res[key] = obj[key];
242
+ }
243
+ }
244
+ return res;
245
+ }
246
+ var tuple = (...args) => args;
247
+ function mkIdMap(xs) {
248
+ return new Map(xs.map((x) => tuple(x.id, x)));
249
+ }
250
+ function notNil(x) {
251
+ return x !== null && x !== void 0;
252
+ }
253
+ function withoutNils(xs) {
254
+ return xs.filter(notNil);
255
+ }
256
+ function mapRecordEntries(callback, record1, record2, record3) {
257
+ return Object.entries(record1).map(([k, v1]) => {
258
+ const v2 = record2 == null ? void 0 : record2[k];
259
+ const v3 = record3 == null ? void 0 : record3[k];
260
+ return callback(
261
+ k,
262
+ v1,
263
+ v2,
264
+ v3
265
+ );
266
+ });
267
+ }
268
+ function mapRecords(callback, record1, record2, record3) {
269
+ return Object.fromEntries(
270
+ mapRecordEntries(
271
+ (k, v1, v2, v3) => [k, callback(k, v1, v2, v3)],
272
+ record1,
273
+ record2,
274
+ record3
275
+ )
276
+ );
277
+ }
278
+
277
279
  // src/serverQueries/common.ts
280
+ import React2 from "react";
278
281
  function createDollarQueries(queryNames) {
279
282
  return Object.fromEntries(
280
283
  queryNames.map((queryName) => {
@@ -1508,6 +1511,7 @@ export {
1508
1511
  makeCacheKey,
1509
1512
  makeQueryCacheKey,
1510
1513
  normalizeData,
1514
+ throwIfPlasmicUndefinedDataError,
1511
1515
  executePlasmicQueries as unstable_executePlasmicQueries,
1512
1516
  usePlasmicQueries as unstable_usePlasmicQueries,
1513
1517
  wrapDollarQueriesForMetadata as unstable_wrapDollarQueriesForMetadata,