@plasmicpkgs/airtable 0.0.258 → 0.0.260

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.
@@ -53,306 +53,113 @@ function _objectWithoutPropertiesLoose(r, e) {
53
53
  }
54
54
  return t;
55
55
  }
56
- function _regeneratorRuntime() {
57
- _regeneratorRuntime = function () {
58
- return e;
59
- };
60
- var t,
61
- e = {},
62
- r = Object.prototype,
63
- n = r.hasOwnProperty,
64
- o = Object.defineProperty || function (t, e, r) {
65
- t[e] = r.value;
66
- },
67
- i = "function" == typeof Symbol ? Symbol : {},
68
- a = i.iterator || "@@iterator",
69
- c = i.asyncIterator || "@@asyncIterator",
70
- u = i.toStringTag || "@@toStringTag";
71
- function define(t, e, r) {
72
- return Object.defineProperty(t, e, {
73
- value: r,
74
- enumerable: !0,
75
- configurable: !0,
76
- writable: !0
77
- }), t[e];
78
- }
79
- try {
80
- define({}, "");
81
- } catch (t) {
82
- define = function (t, e, r) {
83
- return t[e] = r;
84
- };
85
- }
86
- function wrap(t, e, r, n) {
87
- var i = e && e.prototype instanceof Generator ? e : Generator,
88
- a = Object.create(i.prototype),
89
- c = new Context(n || []);
90
- return o(a, "_invoke", {
91
- value: makeInvokeMethod(t, r, c)
92
- }), a;
93
- }
94
- function tryCatch(t, e, r) {
95
- try {
96
- return {
97
- type: "normal",
98
- arg: t.call(e, r)
99
- };
100
- } catch (t) {
101
- return {
102
- type: "throw",
103
- arg: t
104
- };
105
- }
106
- }
107
- e.wrap = wrap;
108
- var h = "suspendedStart",
109
- l = "suspendedYield",
110
- f = "executing",
111
- s = "completed",
112
- y = {};
113
- function Generator() {}
114
- function GeneratorFunction() {}
115
- function GeneratorFunctionPrototype() {}
116
- var p = {};
117
- define(p, a, function () {
118
- return this;
119
- });
120
- var d = Object.getPrototypeOf,
121
- v = d && d(d(values([])));
122
- v && v !== r && n.call(v, a) && (p = v);
123
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
124
- function defineIteratorMethods(t) {
125
- ["next", "throw", "return"].forEach(function (e) {
126
- define(t, e, function (t) {
127
- return this._invoke(e, t);
128
- });
129
- });
130
- }
131
- function AsyncIterator(t, e) {
132
- function invoke(r, o, i, a) {
133
- var c = tryCatch(t[r], t, o);
134
- if ("throw" !== c.type) {
135
- var u = c.arg,
136
- h = u.value;
137
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
138
- invoke("next", t, i, a);
139
- }, function (t) {
140
- invoke("throw", t, i, a);
141
- }) : e.resolve(h).then(function (t) {
142
- u.value = t, i(u);
143
- }, function (t) {
144
- return invoke("throw", t, i, a);
145
- });
146
- }
147
- a(c.arg);
148
- }
149
- var r;
150
- o(this, "_invoke", {
151
- value: function (t, n) {
152
- function callInvokeWithMethodAndArg() {
153
- return new e(function (e, r) {
154
- invoke(t, n, e, r);
155
- });
56
+ function _regenerator() {
57
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
58
+ var e,
59
+ t,
60
+ r = "function" == typeof Symbol ? Symbol : {},
61
+ n = r.iterator || "@@iterator",
62
+ o = r.toStringTag || "@@toStringTag";
63
+ function i(r, n, o, i) {
64
+ var c = n && n.prototype instanceof Generator ? n : Generator,
65
+ u = Object.create(c.prototype);
66
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
67
+ var i,
68
+ c,
69
+ u,
70
+ f = 0,
71
+ p = o || [],
72
+ y = !1,
73
+ G = {
74
+ p: 0,
75
+ n: 0,
76
+ v: e,
77
+ a: d,
78
+ f: d.bind(e, 4),
79
+ d: function (t, r) {
80
+ return i = t, c = 0, u = e, G.n = r, a;
81
+ }
82
+ };
83
+ function d(r, n) {
84
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
85
+ var o,
86
+ i = p[t],
87
+ d = G.p,
88
+ l = i[2];
89
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
156
90
  }
157
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
91
+ if (o || r > 1) return a;
92
+ throw y = !0, n;
158
93
  }
159
- });
160
- }
161
- function makeInvokeMethod(e, r, n) {
162
- var o = h;
163
- return function (i, a) {
164
- if (o === f) throw Error("Generator is already running");
165
- if (o === s) {
166
- if ("throw" === i) throw a;
94
+ return function (o, p, l) {
95
+ if (f > 1) throw TypeError("Generator is already running");
96
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
97
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
98
+ try {
99
+ if (f = 2, i) {
100
+ if (c || (o = "next"), t = i[o]) {
101
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
102
+ if (!t.done) return t;
103
+ u = t.value, c < 2 && (c = 0);
104
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
105
+ i = e;
106
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
107
+ } catch (t) {
108
+ i = e, c = 1, u = t;
109
+ } finally {
110
+ f = 1;
111
+ }
112
+ }
167
113
  return {
168
114
  value: t,
169
- done: !0
115
+ done: y
170
116
  };
171
- }
172
- for (n.method = i, n.arg = a;;) {
173
- var c = n.delegate;
174
- if (c) {
175
- var u = maybeInvokeDelegate(c, n);
176
- if (u) {
177
- if (u === y) continue;
178
- return u;
179
- }
180
- }
181
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
182
- if (o === h) throw o = s, n.arg;
183
- n.dispatchException(n.arg);
184
- } else "return" === n.method && n.abrupt("return", n.arg);
185
- o = f;
186
- var p = tryCatch(e, r, n);
187
- if ("normal" === p.type) {
188
- if (o = n.done ? s : l, p.arg === y) continue;
189
- return {
190
- value: p.arg,
191
- done: n.done
192
- };
193
- }
194
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
195
- }
196
- };
197
- }
198
- function maybeInvokeDelegate(e, r) {
199
- var n = r.method,
200
- o = e.iterator[n];
201
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
202
- var i = tryCatch(o, e.iterator, r.arg);
203
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
204
- var a = i.arg;
205
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
206
- }
207
- function pushTryEntry(t) {
208
- var e = {
209
- tryLoc: t[0]
210
- };
211
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
212
- }
213
- function resetTryEntry(t) {
214
- var e = t.completion || {};
215
- e.type = "normal", delete e.arg, t.completion = e;
216
- }
217
- function Context(t) {
218
- this.tryEntries = [{
219
- tryLoc: "root"
220
- }], t.forEach(pushTryEntry, this), this.reset(!0);
117
+ };
118
+ }(r, o, i), !0), u;
221
119
  }
222
- function values(e) {
223
- if (e || "" === e) {
224
- var r = e[a];
225
- if (r) return r.call(e);
226
- if ("function" == typeof e.next) return e;
227
- if (!isNaN(e.length)) {
228
- var o = -1,
229
- i = function next() {
230
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
231
- return next.value = t, next.done = !0, next;
232
- };
233
- return i.next = i;
234
- }
235
- }
236
- throw new TypeError(typeof e + " is not iterable");
120
+ var a = {};
121
+ function Generator() {}
122
+ function GeneratorFunction() {}
123
+ function GeneratorFunctionPrototype() {}
124
+ t = Object.getPrototypeOf;
125
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
126
+ return this;
127
+ }), t),
128
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
129
+ function f(e) {
130
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
237
131
  }
238
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
239
- value: GeneratorFunctionPrototype,
240
- configurable: !0
241
- }), o(GeneratorFunctionPrototype, "constructor", {
242
- value: GeneratorFunction,
243
- configurable: !0
244
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
245
- var e = "function" == typeof t && t.constructor;
246
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
247
- }, e.mark = function (t) {
248
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
249
- }, e.awrap = function (t) {
250
- return {
251
- __await: t
252
- };
253
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
132
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
254
133
  return this;
255
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
256
- void 0 === i && (i = Promise);
257
- var a = new AsyncIterator(wrap(t, r, n, o), i);
258
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
259
- return t.done ? t.value : a.next();
260
- });
261
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
262
- return this;
263
- }), define(g, "toString", function () {
134
+ }), _regeneratorDefine(u, "toString", function () {
264
135
  return "[object Generator]";
265
- }), e.keys = function (t) {
266
- var e = Object(t),
267
- r = [];
268
- for (var n in e) r.push(n);
269
- return r.reverse(), function next() {
270
- for (; r.length;) {
271
- var t = r.pop();
272
- if (t in e) return next.value = t, next.done = !1, next;
273
- }
274
- return next.done = !0, next;
136
+ }), (_regenerator = function () {
137
+ return {
138
+ w: i,
139
+ m: f
275
140
  };
276
- }, e.values = values, Context.prototype = {
277
- constructor: Context,
278
- reset: function (e) {
279
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
280
- },
281
- stop: function () {
282
- this.done = !0;
283
- var t = this.tryEntries[0].completion;
284
- if ("throw" === t.type) throw t.arg;
285
- return this.rval;
286
- },
287
- dispatchException: function (e) {
288
- if (this.done) throw e;
289
- var r = this;
290
- function handle(n, o) {
291
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
292
- }
293
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
294
- var i = this.tryEntries[o],
295
- a = i.completion;
296
- if ("root" === i.tryLoc) return handle("end");
297
- if (i.tryLoc <= this.prev) {
298
- var c = n.call(i, "catchLoc"),
299
- u = n.call(i, "finallyLoc");
300
- if (c && u) {
301
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
302
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
303
- } else if (c) {
304
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
305
- } else {
306
- if (!u) throw Error("try statement without catch or finally");
307
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
308
- }
309
- }
310
- }
311
- },
312
- abrupt: function (t, e) {
313
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
314
- var o = this.tryEntries[r];
315
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
316
- var i = o;
317
- break;
318
- }
319
- }
320
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
321
- var a = i ? i.completion : {};
322
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
323
- },
324
- complete: function (t, e) {
325
- if ("throw" === t.type) throw t.arg;
326
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
327
- },
328
- finish: function (t) {
329
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
330
- var r = this.tryEntries[e];
331
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
332
- }
333
- },
334
- catch: function (t) {
335
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
336
- var r = this.tryEntries[e];
337
- if (r.tryLoc === t) {
338
- var n = r.completion;
339
- if ("throw" === n.type) {
340
- var o = n.arg;
341
- resetTryEntry(r);
342
- }
343
- return o;
344
- }
345
- }
346
- throw Error("illegal catch attempt");
347
- },
348
- delegateYield: function (e, r, n) {
349
- return this.delegate = {
350
- iterator: values(e),
351
- resultName: r,
352
- nextLoc: n
353
- }, "next" === this.method && (this.arg = t), y;
141
+ })();
142
+ }
143
+ function _regeneratorDefine(e, r, n, t) {
144
+ var i = Object.defineProperty;
145
+ try {
146
+ i({}, "", {});
147
+ } catch (e) {
148
+ i = 0;
149
+ }
150
+ _regeneratorDefine = function (e, r, n, t) {
151
+ function o(r, n) {
152
+ _regeneratorDefine(e, r, function (e) {
153
+ return this._invoke(r, n, e);
154
+ });
354
155
  }
355
- }, e;
156
+ r ? i ? i(e, r, {
157
+ value: n,
158
+ enumerable: !t,
159
+ configurable: !t,
160
+ writable: !t
161
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
162
+ }, _regeneratorDefine(e, r, n, t);
356
163
  }
357
164
 
358
165
  var _excluded = ["table", "children"];
@@ -366,43 +173,40 @@ function AirtableRecord(_ref) {
366
173
  var dataSourceId = credentialsContext && credentialsContext.id;
367
174
  var base = credentialsContext && credentialsContext.base;
368
175
  var host$1 = credentialsContext && credentialsContext.host || defaultHost;
369
- var data = query.usePlasmicQueryData(JSON.stringify(["AirtableRecord", host$1, base, table, record, dataSourceId]), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
176
+ var data = query.usePlasmicQueryData(JSON.stringify(["AirtableRecord", host$1, base, table, record, dataSourceId]), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
370
177
  var pathname, url;
371
- return _regeneratorRuntime().wrap(function _callee$(_context) {
372
- while (1) switch (_context.prev = _context.next) {
178
+ return _regenerator().w(function (_context) {
179
+ while (1) switch (_context.n) {
373
180
  case 0:
374
181
  if (!(!base || !dataSourceId)) {
375
- _context.next = 2;
182
+ _context.n = 1;
376
183
  break;
377
184
  }
378
185
  throw new Error("Missing Data Source. Please select a Data Source from the Airtable Credentials Provider");
379
- case 2:
186
+ case 1:
380
187
  if (table) {
381
- _context.next = 4;
188
+ _context.n = 2;
382
189
  break;
383
190
  }
384
191
  throw new Error("AirtableRecord is missing the table name");
385
- case 4:
192
+ case 2:
386
193
  if (record) {
387
- _context.next = 6;
194
+ _context.n = 3;
388
195
  break;
389
196
  }
390
197
  throw new Error("AirtableRecord is missing the record ID");
391
- case 6:
198
+ case 3:
392
199
  pathname = "/" + base + "/" + table + "/" + record;
393
200
  url = host$1 + "/api/v1/server-data/query?pathname=" + encodeURIComponent(pathname) + "&dataSourceId=" + dataSourceId;
394
- _context.next = 10;
201
+ _context.n = 4;
395
202
  return fetch(url, {
396
203
  method: "GET"
397
204
  });
398
- case 10:
399
- _context.next = 12;
400
- return _context.sent.json();
401
- case 12:
402
- return _context.abrupt("return", _context.sent.fields);
403
- case 13:
404
- case "end":
405
- return _context.stop();
205
+ case 4:
206
+ _context.n = 5;
207
+ return _context.v.json();
208
+ case 5:
209
+ return _context.a(2, _context.v.fields);
406
210
  }
407
211
  }, _callee);
408
212
  })));
@@ -468,37 +272,34 @@ function AirtableCollection(_ref4) {
468
272
  });
469
273
  }
470
274
  var search = searchArray.length === 0 ? "" : "?" + searchArray.join("&");
471
- var _usePlasmicQueryData = query.usePlasmicQueryData(JSON.stringify(["AirtableCollection", host$1, base, table, search, dataSourceId]), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
275
+ var _usePlasmicQueryData = query.usePlasmicQueryData(JSON.stringify(["AirtableCollection", host$1, base, table, search, dataSourceId]), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
472
276
  var pathname, url;
473
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
474
- while (1) switch (_context2.prev = _context2.next) {
277
+ return _regenerator().w(function (_context2) {
278
+ while (1) switch (_context2.n) {
475
279
  case 0:
476
280
  if (!(!base || !dataSourceId)) {
477
- _context2.next = 2;
281
+ _context2.n = 1;
478
282
  break;
479
283
  }
480
284
  throw new Error("Missing Data Source. Please select a Data Source from the Airtable Credentials Provider");
481
- case 2:
285
+ case 1:
482
286
  if (table) {
483
- _context2.next = 4;
287
+ _context2.n = 2;
484
288
  break;
485
289
  }
486
290
  throw new Error("AirtableCollection is missing the table name");
487
- case 4:
291
+ case 2:
488
292
  pathname = "/" + base + "/" + table + search;
489
293
  url = host$1 + "/api/v1/server-data/query?pathname=" + encodeURIComponent(pathname) + "&dataSourceId=" + dataSourceId;
490
- _context2.next = 8;
294
+ _context2.n = 3;
491
295
  return fetch(url, {
492
296
  method: "GET"
493
297
  });
494
- case 8:
495
- _context2.next = 10;
496
- return _context2.sent.json();
497
- case 10:
498
- return _context2.abrupt("return", _context2.sent.records);
499
- case 11:
500
- case "end":
501
- return _context2.stop();
298
+ case 3:
299
+ _context2.n = 4;
300
+ return _context2.v.json();
301
+ case 4:
302
+ return _context2.a(2, _context2.v.records);
502
303
  }
503
304
  }, _callee2);
504
305
  }))),
@@ -1 +1 @@
1
- {"version":3,"file":"airtable.cjs.development.js","sources":["../src/RecordData.tsx","../src/index.tsx"],"sourcesContent":["import {\n DataProvider,\n repeatedElement,\n usePlasmicCanvasContext,\n useSelector,\n} from \"@plasmicapp/host\";\nimport registerComponent, {\n CanvasComponentProps,\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext, {\n GlobalContextMeta,\n} from \"@plasmicapp/host/registerGlobalContext\";\nimport { usePlasmicQueryData } from \"@plasmicapp/query\";\nimport React from \"react\";\n\nconst defaultHost = \"https://studio.plasmic.app\";\n\nexport interface DataSourceInfo {\n id: string;\n base: string;\n host?: string;\n}\n\nconst CredentialsContext = React.createContext<DataSourceInfo | undefined>(\n undefined\n);\n\ninterface RecordData {\n [field: string]: string | { id: string; url: string; filename: string }[];\n}\n\nexport interface AirtableRecordProps {\n table: string;\n record: string;\n}\n\nexport function AirtableRecord({\n table,\n record,\n children,\n}: React.PropsWithChildren<AirtableRecordProps>) {\n const credentialsContext = React.useContext(CredentialsContext);\n\n const dataSourceId = credentialsContext && credentialsContext.id;\n const base = credentialsContext && credentialsContext.base;\n const host = (credentialsContext && credentialsContext.host) || defaultHost;\n\n const data = usePlasmicQueryData(\n JSON.stringify([\"AirtableRecord\", host, base, table, record, dataSourceId]),\n async () => {\n if (!base || !dataSourceId) {\n throw new Error(\n \"Missing Data Source. Please select a Data Source from the Airtable Credentials Provider\"\n );\n }\n if (!table) {\n throw new Error(\"AirtableRecord is missing the table name\");\n }\n if (!record) {\n throw new Error(\"AirtableRecord is missing the record ID\");\n }\n const pathname = `/${base}/${table}/${record}`;\n const url = `${host}/api/v1/server-data/query?pathname=${encodeURIComponent(\n pathname\n )}&dataSourceId=${dataSourceId}`;\n return (await (await fetch(url, { method: \"GET\" })).json())\n .fields as RecordData;\n }\n );\n\n if (\"error\" in data) {\n return <p>Error: {data.error?.message}</p>;\n }\n\n if (!(\"data\" in data)) {\n return <p>Loading...</p>;\n }\n\n return (\n <DataProvider name={contextKey} data={data.data}>\n {children}\n </DataProvider>\n );\n}\n\nconst contextKey = \"__airtableRecord\";\n\nfunction useRecord() {\n return useSelector(contextKey) as RecordData | undefined;\n}\n\nexport interface AirtableRecordFieldProps\n extends CanvasComponentProps<RecordData | undefined> {\n className?: string;\n style?: React.CSSProperties;\n field?: string;\n}\n\nexport function AirtableRecordField({\n className,\n field,\n style,\n setControlContextData,\n}: AirtableRecordFieldProps) {\n const record = useRecord();\n setControlContextData?.(record);\n\n return (\n <div className={className} style={style}>\n {record\n ? (() => {\n const val = record[field || Object.keys(record)[0]];\n if (val && typeof val === \"object\") {\n return \"Attachment \" + val[0].filename;\n }\n return val;\n })()\n : \"Error: Must provide a record to AirtableRecordField\"}\n </div>\n );\n}\n\nexport interface AirtableCollectionProps {\n table: string;\n fields?: string[];\n filterByFormula?: string;\n maxRecords?: number;\n pageSize?: number;\n sort?: {\n field: string;\n direction?: \"asc\" | \"desc\";\n }[];\n view?: string;\n}\n\nexport function AirtableCollection({\n table,\n children,\n ...props\n}: React.PropsWithChildren<AirtableCollectionProps>) {\n const credentialsContext = React.useContext(CredentialsContext);\n\n const dataSourceId = credentialsContext && credentialsContext.id;\n const base = credentialsContext && credentialsContext.base;\n const host = (credentialsContext && credentialsContext.host) || defaultHost;\n\n const searchArray: string[] = [];\n if (props.fields) {\n props.fields.forEach((f) =>\n searchArray.push(\n `${encodeURIComponent(`fields[]`)}=${encodeURIComponent(`${f}`)}`\n )\n );\n }\n ([\"filterByFormula\", \"maxRecords\", \"pageSize\", \"view\"] as const).forEach(\n (prop) => {\n if (props[prop]) {\n searchArray.push(\n `${encodeURIComponent(`${prop}`)}=${encodeURIComponent(\n `${props[prop]}`\n )}`\n );\n }\n }\n );\n if (props.sort) {\n props.sort.forEach((v, i) => {\n searchArray.push(\n `${encodeURIComponent(`sort[${i}][field]`)}=${encodeURIComponent(\n `${v.field}`\n )}`\n );\n if (v.direction) {\n searchArray.push(\n `${encodeURIComponent(`sort[${i}][direction]`)}=${encodeURIComponent(\n `${v.direction}`\n )}`\n );\n }\n });\n }\n\n const search = searchArray.length === 0 ? \"\" : \"?\" + searchArray.join(\"&\");\n\n const { data, error, isLoading } = usePlasmicQueryData(\n JSON.stringify([\n \"AirtableCollection\",\n host,\n base,\n table,\n search,\n dataSourceId,\n ]),\n async () => {\n if (!base || !dataSourceId) {\n throw new Error(\n \"Missing Data Source. Please select a Data Source from the Airtable Credentials Provider\"\n );\n }\n if (!table) {\n throw new Error(\"AirtableCollection is missing the table name\");\n }\n const pathname = `/${base}/${table}${search}`;\n const url = `${host}/api/v1/server-data/query?pathname=${encodeURIComponent(\n pathname\n )}&dataSourceId=${dataSourceId}`;\n return (await (await fetch(url, { method: \"GET\" })).json()).records as {\n fields: RecordData;\n id: string;\n }[];\n }\n );\n\n if (error) {\n return <p>Error: {error.message}</p>;\n }\n\n if (isLoading) {\n return <p>Loading...</p>;\n }\n\n return (\n <>\n {(data ?? []).map((record, index) => (\n <DataProvider key={record.id} name={contextKey} data={record.fields}>\n {repeatedElement(index, children)}\n </DataProvider>\n ))}\n </>\n );\n}\n\ninterface AirtableCredentialsProviderProps {\n dataSource: DataSourceInfo;\n host?: string;\n}\n\nexport function AirtableCredentialsProvider({\n dataSource,\n host: maybeHost,\n children,\n}: React.PropsWithChildren<AirtableCredentialsProviderProps>) {\n const inCanvas = usePlasmicCanvasContext();\n if (inCanvas && (!dataSource || !dataSource.id || !dataSource.base)) {\n return (\n <p>\n Error: Missing Data Source. Please select a Data Source from the\n Airtable Credentials Provider\n </p>\n );\n }\n const host = maybeHost || defaultHost;\n return (\n <CredentialsContext.Provider value={{ ...dataSource, host }}>\n {children}\n </CredentialsContext.Provider>\n );\n}\n\nconst thisModule = \"@plasmicpkgs/airtable\";\n\nexport const airtableRecordMeta: CodeComponentMeta<AirtableRecordProps> = {\n name: \"hostless-airtable-record\",\n displayName: \"Airtable Record\",\n importPath: thisModule,\n importName: \"AirtableRecord\",\n providesData: true,\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"component\",\n name: \"hostless-airtable-record-field\",\n },\n },\n table: {\n type: \"string\",\n displayName: \"Table Name\",\n description: \"The Airtable table name or ID\",\n },\n record: {\n type: \"string\",\n displayName: \"Record\",\n description: \"The table record ID\",\n },\n },\n};\n\nexport function registerAirtableRecord(\n loader?: { registerComponent: typeof registerComponent },\n customAirtableRecordMeta?: CodeComponentMeta<AirtableRecordProps>\n) {\n if (loader) {\n loader.registerComponent(\n AirtableRecord,\n customAirtableRecordMeta ?? airtableRecordMeta\n );\n } else {\n registerComponent(\n AirtableRecord,\n customAirtableRecordMeta ?? airtableRecordMeta\n );\n }\n}\n\nexport const airtableRecordFieldMeta: CodeComponentMeta<AirtableRecordFieldProps> =\n {\n name: \"hostless-airtable-record-field\",\n displayName: \"Airtable Record Field\",\n importPath: thisModule,\n importName: \"AirtableRecordField\",\n props: {\n field: {\n type: \"choice\",\n displayName: \"Field Name\",\n defaultValueHint: \"The first field\",\n options: (_props, data) => {\n return data ? Object.keys(data) : [\"Data unavailable\"];\n },\n },\n },\n };\n\nexport function registerAirtableRecordField(\n loader?: { registerComponent: typeof registerComponent },\n customAirtableRecordFieldMeta?: CodeComponentMeta<AirtableRecordFieldProps>\n) {\n if (loader) {\n loader.registerComponent(\n AirtableRecordField,\n customAirtableRecordFieldMeta ?? airtableRecordFieldMeta\n );\n } else {\n registerComponent(\n AirtableRecordField,\n customAirtableRecordFieldMeta ?? airtableRecordFieldMeta\n );\n }\n}\n\nexport const airtableCollectionMeta: CodeComponentMeta<AirtableCollectionProps> =\n {\n name: \"hostless-airtable-collection\",\n displayName: \"Airtable Collection\",\n importPath: thisModule,\n importName: \"AirtableCollection\",\n providesData: true,\n props: {\n children: {\n type: \"slot\",\n isRepeated: true,\n defaultValue: {\n type: \"component\",\n name: \"hostless-airtable-record-field\",\n },\n },\n table: {\n type: \"string\",\n displayName: \"Table Name\",\n description: \"The Airtable table name or ID\",\n },\n fields: {\n type: \"object\",\n displayName: \"Fields\",\n description: \"List of strings containing the fields to be included\",\n },\n maxRecords: {\n type: \"number\",\n displayName: \"Max Records\",\n description:\n \"The maximum total number of records that will be returned\",\n defaultValueHint: 100,\n max: 100,\n min: 1,\n },\n view: {\n type: \"string\",\n displayName: \"View\",\n description:\n \"The name or ID of a view in the table. If set, only records from that view will be returned\",\n },\n sort: {\n type: \"object\",\n displayName: \"Sort\",\n description:\n 'A list of Airtable sort objects that specifies how the records will be ordered. Each sort object must have a field key specifying the name of the field to sort on, and an optional direction key that is either \"asc\" or \"desc\". The default direction is \"asc\"',\n },\n filterByFormula: {\n type: \"string\",\n displayName: \"Filter by Formula\",\n description: \"An Airtable formula used to filter records\",\n },\n },\n };\n\nexport function registerAirtableCollection(\n loader?: { registerComponent: typeof registerComponent },\n customAirtableCollectionMeta?: CodeComponentMeta<AirtableCollectionProps>\n) {\n if (loader) {\n loader.registerComponent(\n AirtableCollection,\n customAirtableCollectionMeta ?? airtableCollectionMeta\n );\n } else {\n registerComponent(\n AirtableCollection,\n customAirtableCollectionMeta ?? airtableCollectionMeta\n );\n }\n}\n\nexport const airtableCredentialsProviderMeta: GlobalContextMeta<AirtableCredentialsProviderProps> =\n {\n name: \"hostless-airtable-credentials-provider\",\n displayName: \"Airtable Credentials Provider\",\n importPath: thisModule,\n importName: \"AirtableCredentialsProvider\",\n props: {\n dataSource: {\n type: \"dataSource\",\n dataSource: \"airtable\",\n displayName: \"Data Source\",\n description: \"The Airtable Data Source to use\",\n },\n host: {\n type: \"string\",\n displayName: \"Host\",\n description: \"Plasmic Server-Data URL\",\n defaultValueHint: defaultHost,\n },\n },\n };\n\nexport function registerAirtableCredentialsProvider(\n loader?: { registerGlobalContext: typeof registerGlobalContext },\n customAirtableCredentialsProviderMeta?: GlobalContextMeta<AirtableCredentialsProviderProps>\n) {\n if (loader) {\n loader.registerGlobalContext(\n AirtableCredentialsProvider,\n customAirtableCredentialsProviderMeta ?? airtableCredentialsProviderMeta\n );\n } else {\n registerGlobalContext(\n AirtableCredentialsProvider,\n customAirtableCredentialsProviderMeta ?? airtableCredentialsProviderMeta\n );\n }\n}\n","export * from \"./RecordData\";\nimport {\n registerAirtableCollection,\n registerAirtableCredentialsProvider,\n registerAirtableRecord,\n registerAirtableRecordField,\n} from \"./RecordData\";\nimport registerComponent from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\n\nexport function registerAll(loader?: {\n registerComponent: typeof registerComponent;\n registerGlobalContext: typeof registerGlobalContext;\n}) {\n registerAirtableCollection(loader);\n registerAirtableCredentialsProvider(loader);\n registerAirtableRecord(loader);\n registerAirtableRecordField(loader);\n}\n"],"names":["defaultHost","CredentialsContext","React","createContext","undefined","AirtableRecord","_ref","table","record","children","credentialsContext","useContext","dataSourceId","id","base","host","data","usePlasmicQueryData","JSON","stringify","_asyncToGenerator","_regeneratorRuntime","mark","_callee","pathname","url","wrap","_callee$","_context","prev","next","Error","encodeURIComponent","fetch","method","sent","json","abrupt","fields","stop","_data$error","error","message","DataProvider","name","contextKey","useRecord","useSelector","AirtableRecordField","_ref3","className","field","style","setControlContextData","val","Object","keys","filename","AirtableCollection","_ref4","props","_objectWithoutPropertiesLoose","_excluded","searchArray","forEach","f","push","prop","sort","v","i","direction","search","length","join","_usePlasmicQueryData","_callee2","_callee2$","_context2","records","isLoading","map","index","key","repeatedElement","AirtableCredentialsProvider","_ref6","dataSource","maybeHost","inCanvas","usePlasmicCanvasContext","Provider","value","_extends","thisModule","airtableRecordMeta","displayName","importPath","importName","providesData","type","defaultValue","description","registerAirtableRecord","loader","customAirtableRecordMeta","registerComponent","airtableRecordFieldMeta","defaultValueHint","options","_props","registerAirtableRecordField","customAirtableRecordFieldMeta","airtableCollectionMeta","isRepeated","maxRecords","max","min","view","filterByFormula","registerAirtableCollection","customAirtableCollectionMeta","airtableCredentialsProviderMeta","registerAirtableCredentialsProvider","customAirtableCredentialsProviderMeta","registerGlobalContext","registerAll"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAMA,WAAW,GAAG,4BAA4B;AAQhD,IAAMC,kBAAkB,gBAAGC,KAAK,CAACC,aAAa,CAC5CC,SAAS,CACV;SAWeC,cAAcA,CAAAC,IAAA;MAC5BC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;EAER,IAAMC,kBAAkB,GAAGR,KAAK,CAACS,UAAU,CAACV,kBAAkB,CAAC;EAE/D,IAAMW,YAAY,GAAGF,kBAAkB,IAAIA,kBAAkB,CAACG,EAAE;EAChE,IAAMC,IAAI,GAAGJ,kBAAkB,IAAIA,kBAAkB,CAACI,IAAI;EAC1D,IAAMC,MAAI,GAAIL,kBAAkB,IAAIA,k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AAIR,sBAAsB,CACvD;;AAEL;IAEaS,+BAA+B,GAC1C;EACE9E,IAAI,EAAE,wCAAwC;EAC9CoD,WAAW,EAAE,+BAA+B;EAC5CC,UAAU,EAAEH,UAAU;EACtBI,UAAU,EAAE,6BAA6B;EACzCtC,KAAK,EAAE;IACL2B,UAAU,EAAE;MACVa,IAAI,EAAE,YAAY;MAClBb,UAAU,EAAE,UAAU;MACtBS,WAAW,EAAE,aAAa;MAC1BM,WAAW,EAAE;KACd;IACDvF,IAAI,EAAE;MACJqF,IAAI,EAAE,QAAQ;MACdJ,WAAW,EAAE,MAAM;MACnBM,WAAW,EAAE,yBAAyB;MACtCM,gBAAgB,EAAE5G;;;;SAKV2H,mCAAmCA,CACjDnB,MAAgE,EAChEoB,qCAA2F;EAE3F,IAAIpB,MAAM,EAAE;IACVA,MAAM,CAACqB,qBAAqB,CAC1BxC,2BAA2B,EAC3BuC,qCAAqC,WAArCA,qCAAqC,GAAIF,+BAA+B,CACzE;GACF,MAAM;IACLG,qBAAqB,CACnBxC,2BAA2B,EAC3BuC,qCAAqC,WAArCA,qCAAqC,GAAIF,+BAA+B,CACzE;;AAEL;;SCxbgBI,WAAWA,CAACtB,MAG3B;EACCgB,0BAA0B,CAAChB,MAAM,CAAC;EAClCmB,mCAAmC,CAACnB,MAAM,CAAC;EAC3CD,sBAAsB,CAACC,MAAM,CAAC;EAC9BO,2BAA2B,CAACP,MAAM,CAAC;AACrC;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"airtable.cjs.development.js","sources":["../src/RecordData.tsx","../src/index.tsx"],"sourcesContent":["import {\n DataProvider,\n repeatedElement,\n usePlasmicCanvasContext,\n useSelector,\n} from \"@plasmicapp/host\";\nimport registerComponent, {\n CanvasComponentProps,\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext, {\n GlobalContextMeta,\n} from \"@plasmicapp/host/registerGlobalContext\";\nimport { usePlasmicQueryData } from \"@plasmicapp/query\";\nimport React from \"react\";\n\nconst defaultHost = \"https://studio.plasmic.app\";\n\nexport interface DataSourceInfo {\n id: string;\n base: string;\n host?: string;\n}\n\nconst CredentialsContext = React.createContext<DataSourceInfo | undefined>(\n undefined\n);\n\ninterface RecordData {\n [field: string]: string | { id: string; url: string; filename: string }[];\n}\n\nexport interface AirtableRecordProps {\n table: string;\n record: string;\n}\n\nexport function AirtableRecord({\n table,\n record,\n children,\n}: React.PropsWithChildren<AirtableRecordProps>) {\n const credentialsContext = React.useContext(CredentialsContext);\n\n const dataSourceId = credentialsContext && credentialsContext.id;\n const base = credentialsContext && credentialsContext.base;\n const host = (credentialsContext && credentialsContext.host) || defaultHost;\n\n const data = usePlasmicQueryData(\n JSON.stringify([\"AirtableRecord\", host, base, table, record, dataSourceId]),\n async () => {\n if (!base || !dataSourceId) {\n throw new Error(\n \"Missing Data Source. Please select a Data Source from the Airtable Credentials Provider\"\n );\n }\n if (!table) {\n throw new Error(\"AirtableRecord is missing the table name\");\n }\n if (!record) {\n throw new Error(\"AirtableRecord is missing the record ID\");\n }\n const pathname = `/${base}/${table}/${record}`;\n const url = `${host}/api/v1/server-data/query?pathname=${encodeURIComponent(\n pathname\n )}&dataSourceId=${dataSourceId}`;\n return (await (await fetch(url, { method: \"GET\" })).json())\n .fields as RecordData;\n }\n );\n\n if (\"error\" in data) {\n return <p>Error: {data.error?.message}</p>;\n }\n\n if (!(\"data\" in data)) {\n return <p>Loading...</p>;\n }\n\n return (\n <DataProvider name={contextKey} data={data.data}>\n {children}\n </DataProvider>\n );\n}\n\nconst contextKey = \"__airtableRecord\";\n\nfunction useRecord() {\n return useSelector(contextKey) as RecordData | undefined;\n}\n\nexport interface AirtableRecordFieldProps\n extends CanvasComponentProps<RecordData | undefined> {\n className?: string;\n style?: React.CSSProperties;\n field?: string;\n}\n\nexport function AirtableRecordField({\n className,\n field,\n style,\n setControlContextData,\n}: AirtableRecordFieldProps) {\n const record = useRecord();\n setControlContextData?.(record);\n\n return (\n <div className={className} style={style}>\n {record\n ? (() => {\n const val = record[field || Object.keys(record)[0]];\n if (val && typeof val === \"object\") {\n return \"Attachment \" + val[0].filename;\n }\n return val;\n })()\n : \"Error: Must provide a record to AirtableRecordField\"}\n </div>\n );\n}\n\nexport interface AirtableCollectionProps {\n table: string;\n fields?: string[];\n filterByFormula?: string;\n maxRecords?: number;\n pageSize?: number;\n sort?: {\n field: string;\n direction?: \"asc\" | \"desc\";\n }[];\n view?: string;\n}\n\nexport function AirtableCollection({\n table,\n children,\n ...props\n}: React.PropsWithChildren<AirtableCollectionProps>) {\n const credentialsContext = React.useContext(CredentialsContext);\n\n const dataSourceId = credentialsContext && credentialsContext.id;\n const base = credentialsContext && credentialsContext.base;\n const host = (credentialsContext && credentialsContext.host) || defaultHost;\n\n const searchArray: string[] = [];\n if (props.fields) {\n props.fields.forEach((f) =>\n searchArray.push(\n `${encodeURIComponent(`fields[]`)}=${encodeURIComponent(`${f}`)}`\n )\n );\n }\n ([\"filterByFormula\", \"maxRecords\", \"pageSize\", \"view\"] as const).forEach(\n (prop) => {\n if (props[prop]) {\n searchArray.push(\n `${encodeURIComponent(`${prop}`)}=${encodeURIComponent(\n `${props[prop]}`\n )}`\n );\n }\n }\n );\n if (props.sort) {\n props.sort.forEach((v, i) => {\n searchArray.push(\n `${encodeURIComponent(`sort[${i}][field]`)}=${encodeURIComponent(\n `${v.field}`\n )}`\n );\n if (v.direction) {\n searchArray.push(\n `${encodeURIComponent(`sort[${i}][direction]`)}=${encodeURIComponent(\n `${v.direction}`\n )}`\n );\n }\n });\n }\n\n const search = searchArray.length === 0 ? \"\" : \"?\" + searchArray.join(\"&\");\n\n const { data, error, isLoading } = usePlasmicQueryData(\n JSON.stringify([\n \"AirtableCollection\",\n host,\n base,\n table,\n search,\n dataSourceId,\n ]),\n async () => {\n if (!base || !dataSourceId) {\n throw new Error(\n \"Missing Data Source. Please select a Data Source from the Airtable Credentials Provider\"\n );\n }\n if (!table) {\n throw new Error(\"AirtableCollection is missing the table name\");\n }\n const pathname = `/${base}/${table}${search}`;\n const url = `${host}/api/v1/server-data/query?pathname=${encodeURIComponent(\n pathname\n )}&dataSourceId=${dataSourceId}`;\n return (await (await fetch(url, { method: \"GET\" })).json()).records as {\n fields: RecordData;\n id: string;\n }[];\n }\n );\n\n if (error) {\n return <p>Error: {error.message}</p>;\n }\n\n if (isLoading) {\n return <p>Loading...</p>;\n }\n\n return (\n <>\n {(data ?? []).map((record, index) => (\n <DataProvider key={record.id} name={contextKey} data={record.fields}>\n {repeatedElement(index, children)}\n </DataProvider>\n ))}\n </>\n );\n}\n\ninterface AirtableCredentialsProviderProps {\n dataSource: DataSourceInfo;\n host?: string;\n}\n\nexport function AirtableCredentialsProvider({\n dataSource,\n host: maybeHost,\n children,\n}: React.PropsWithChildren<AirtableCredentialsProviderProps>) {\n const inCanvas = usePlasmicCanvasContext();\n if (inCanvas && (!dataSource || !dataSource.id || !dataSource.base)) {\n return (\n <p>\n Error: Missing Data Source. Please select a Data Source from the\n Airtable Credentials Provider\n </p>\n );\n }\n const host = maybeHost || defaultHost;\n return (\n <CredentialsContext.Provider value={{ ...dataSource, host }}>\n {children}\n </CredentialsContext.Provider>\n );\n}\n\nconst thisModule = \"@plasmicpkgs/airtable\";\n\nexport const airtableRecordMeta: CodeComponentMeta<AirtableRecordProps> = {\n name: \"hostless-airtable-record\",\n displayName: \"Airtable Record\",\n importPath: thisModule,\n importName: \"AirtableRecord\",\n providesData: true,\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"component\",\n name: \"hostless-airtable-record-field\",\n },\n },\n table: {\n type: \"string\",\n displayName: \"Table Name\",\n description: \"The Airtable table name or ID\",\n },\n record: {\n type: \"string\",\n displayName: \"Record\",\n description: \"The table record ID\",\n },\n },\n};\n\nexport function registerAirtableRecord(\n loader?: { registerComponent: typeof registerComponent },\n customAirtableRecordMeta?: CodeComponentMeta<AirtableRecordProps>\n) {\n if (loader) {\n loader.registerComponent(\n AirtableRecord,\n customAirtableRecordMeta ?? airtableRecordMeta\n );\n } else {\n registerComponent(\n AirtableRecord,\n customAirtableRecordMeta ?? airtableRecordMeta\n );\n }\n}\n\nexport const airtableRecordFieldMeta: CodeComponentMeta<AirtableRecordFieldProps> =\n {\n name: \"hostless-airtable-record-field\",\n displayName: \"Airtable Record Field\",\n importPath: thisModule,\n importName: \"AirtableRecordField\",\n props: {\n field: {\n type: \"choice\",\n displayName: \"Field Name\",\n defaultValueHint: \"The first field\",\n options: (_props, data) => {\n return data ? Object.keys(data) : [\"Data unavailable\"];\n },\n },\n },\n };\n\nexport function registerAirtableRecordField(\n loader?: { registerComponent: typeof registerComponent },\n customAirtableRecordFieldMeta?: CodeComponentMeta<AirtableRecordFieldProps>\n) {\n if (loader) {\n loader.registerComponent(\n AirtableRecordField,\n customAirtableRecordFieldMeta ?? airtableRecordFieldMeta\n );\n } else {\n registerComponent(\n AirtableRecordField,\n customAirtableRecordFieldMeta ?? airtableRecordFieldMeta\n );\n }\n}\n\nexport const airtableCollectionMeta: CodeComponentMeta<AirtableCollectionProps> =\n {\n name: \"hostless-airtable-collection\",\n displayName: \"Airtable Collection\",\n importPath: thisModule,\n importName: \"AirtableCollection\",\n providesData: true,\n props: {\n children: {\n type: \"slot\",\n isRepeated: true,\n defaultValue: {\n type: \"component\",\n name: \"hostless-airtable-record-field\",\n },\n },\n table: {\n type: \"string\",\n displayName: \"Table Name\",\n description: \"The Airtable table name or ID\",\n },\n fields: {\n type: \"object\",\n displayName: \"Fields\",\n description: \"List of strings containing the fields to be included\",\n },\n maxRecords: {\n type: \"number\",\n displayName: \"Max Records\",\n description:\n \"The maximum total number of records that will be returned\",\n defaultValueHint: 100,\n max: 100,\n min: 1,\n },\n view: {\n type: \"string\",\n displayName: \"View\",\n description:\n \"The name or ID of a view in the table. If set, only records from that view will be returned\",\n },\n sort: {\n type: \"object\",\n displayName: \"Sort\",\n description:\n 'A list of Airtable sort objects that specifies how the records will be ordered. Each sort object must have a field key specifying the name of the field to sort on, and an optional direction key that is either \"asc\" or \"desc\". The default direction is \"asc\"',\n },\n filterByFormula: {\n type: \"string\",\n displayName: \"Filter by Formula\",\n description: \"An Airtable formula used to filter records\",\n },\n },\n };\n\nexport function registerAirtableCollection(\n loader?: { registerComponent: typeof registerComponent },\n customAirtableCollectionMeta?: CodeComponentMeta<AirtableCollectionProps>\n) {\n if (loader) {\n loader.registerComponent(\n AirtableCollection,\n customAirtableCollectionMeta ?? airtableCollectionMeta\n );\n } else {\n registerComponent(\n AirtableCollection,\n customAirtableCollectionMeta ?? airtableCollectionMeta\n );\n }\n}\n\nexport const airtableCredentialsProviderMeta: GlobalContextMeta<AirtableCredentialsProviderProps> =\n {\n name: \"hostless-airtable-credentials-provider\",\n displayName: \"Airtable Credentials Provider\",\n importPath: thisModule,\n importName: \"AirtableCredentialsProvider\",\n props: {\n dataSource: {\n type: \"dataSource\",\n dataSource: \"airtable\",\n displayName: \"Data Source\",\n description: \"The Airtable Data Source to use\",\n },\n host: {\n type: \"string\",\n displayName: \"Host\",\n description: \"Plasmic Server-Data URL\",\n defaultValueHint: defaultHost,\n },\n },\n };\n\nexport function registerAirtableCredentialsProvider(\n loader?: { registerGlobalContext: typeof registerGlobalContext },\n customAirtableCredentialsProviderMeta?: GlobalContextMeta<AirtableCredentialsProviderProps>\n) {\n if (loader) {\n loader.registerGlobalContext(\n AirtableCredentialsProvider,\n customAirtableCredentialsProviderMeta ?? airtableCredentialsProviderMeta\n );\n } else {\n registerGlobalContext(\n AirtableCredentialsProvider,\n customAirtableCredentialsProviderMeta ?? airtableCredentialsProviderMeta\n );\n }\n}\n","export * from \"./RecordData\";\nimport {\n registerAirtableCollection,\n registerAirtableCredentialsProvider,\n registerAirtableRecord,\n registerAirtableRecordField,\n} from \"./RecordData\";\nimport registerComponent from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\n\nexport function registerAll(loader?: {\n registerComponent: typeof registerComponent;\n registerGlobalContext: typeof registerGlobalContext;\n}) {\n registerAirtableCollection(loader);\n registerAirtableCredentialsProvider(loader);\n registerAirtableRecord(loader);\n registerAirtableRecordField(loader);\n}\n"],"names":["defaultHost","CredentialsContext","React","createContext","undefined","AirtableRecord","_ref","table","record","children","credentialsContext","useContext","dataSourceId","id","base","host","data","usePlasmicQueryData","JSON","stringify","_asyncToGenerator","_regenerator","m","_callee","pathname","url","w","_context","n","Error","encodeURIComponent","fetch","method","v","json","a","fields","_data$error","error","message","DataProvider","name","contextKey","useRecord","useSelector","AirtableRecordField","_ref3","className","field","style","setControlContextData","val","Object","keys","filename","AirtableCollection","_ref4","props","_objectWithoutPropertiesLoose","_excluded","searchArray","forEach","f","push","prop","sort","i","direction","search","length","join","_usePlasmicQueryData","_callee2","_context2","records","isLoading","map","index","key","repeatedElement","AirtableCredentialsProvider","_ref6","dataSource","maybeHost","inCanvas","usePlasmicCanvasContext","Provider","value","_extends","thisModule","airtableRecordMeta","displayName","importPath","importName","providesData","type","defaultValue","description","registerAirtableRecord","loader","customAirtableRecordMeta","registerComponent","airtableRecordFieldMeta","defaultValueHint","options","_props","registerAirtableRecordField","customAirtableRecordFieldMeta","airtableCollectionMeta","isRepeated","maxRecords","max","min","view","filterByFormula","registerAirtableCollection","customAirtableCollectionMeta","airtableCredentialsProviderMeta","registerAirtableCredentialsProvider","customAirtableCredentialsProviderMeta","registerGlobalContext","registerAll"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAMA,WAAW,GAAG,4BAA4B;AAQhD,IAAMC,kBAAkB,gBAAGC,KAAK,CAACC,aAAa,CAC5CC,SAAS,CACV;SAWeC,cAAcA,CAAAC,IAAA;MAC5BC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,MAA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