@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.
@@ -47,306 +47,113 @@ function _objectWithoutPropertiesLoose(r, e) {
47
47
  }
48
48
  return t;
49
49
  }
50
- function _regeneratorRuntime() {
51
- _regeneratorRuntime = function () {
52
- return e;
53
- };
54
- var t,
55
- e = {},
56
- r = Object.prototype,
57
- n = r.hasOwnProperty,
58
- o = Object.defineProperty || function (t, e, r) {
59
- t[e] = r.value;
60
- },
61
- i = "function" == typeof Symbol ? Symbol : {},
62
- a = i.iterator || "@@iterator",
63
- c = i.asyncIterator || "@@asyncIterator",
64
- u = i.toStringTag || "@@toStringTag";
65
- function define(t, e, r) {
66
- return Object.defineProperty(t, e, {
67
- value: r,
68
- enumerable: !0,
69
- configurable: !0,
70
- writable: !0
71
- }), t[e];
72
- }
73
- try {
74
- define({}, "");
75
- } catch (t) {
76
- define = function (t, e, r) {
77
- return t[e] = r;
78
- };
79
- }
80
- function wrap(t, e, r, n) {
81
- var i = e && e.prototype instanceof Generator ? e : Generator,
82
- a = Object.create(i.prototype),
83
- c = new Context(n || []);
84
- return o(a, "_invoke", {
85
- value: makeInvokeMethod(t, r, c)
86
- }), a;
87
- }
88
- function tryCatch(t, e, r) {
89
- try {
90
- return {
91
- type: "normal",
92
- arg: t.call(e, r)
93
- };
94
- } catch (t) {
95
- return {
96
- type: "throw",
97
- arg: t
98
- };
99
- }
100
- }
101
- e.wrap = wrap;
102
- var h = "suspendedStart",
103
- l = "suspendedYield",
104
- f = "executing",
105
- s = "completed",
106
- y = {};
107
- function Generator() {}
108
- function GeneratorFunction() {}
109
- function GeneratorFunctionPrototype() {}
110
- var p = {};
111
- define(p, a, function () {
112
- return this;
113
- });
114
- var d = Object.getPrototypeOf,
115
- v = d && d(d(values([])));
116
- v && v !== r && n.call(v, a) && (p = v);
117
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
118
- function defineIteratorMethods(t) {
119
- ["next", "throw", "return"].forEach(function (e) {
120
- define(t, e, function (t) {
121
- return this._invoke(e, t);
122
- });
123
- });
124
- }
125
- function AsyncIterator(t, e) {
126
- function invoke(r, o, i, a) {
127
- var c = tryCatch(t[r], t, o);
128
- if ("throw" !== c.type) {
129
- var u = c.arg,
130
- h = u.value;
131
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
132
- invoke("next", t, i, a);
133
- }, function (t) {
134
- invoke("throw", t, i, a);
135
- }) : e.resolve(h).then(function (t) {
136
- u.value = t, i(u);
137
- }, function (t) {
138
- return invoke("throw", t, i, a);
139
- });
140
- }
141
- a(c.arg);
142
- }
143
- var r;
144
- o(this, "_invoke", {
145
- value: function (t, n) {
146
- function callInvokeWithMethodAndArg() {
147
- return new e(function (e, r) {
148
- invoke(t, n, e, r);
149
- });
50
+ function _regenerator() {
51
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
52
+ var e,
53
+ t,
54
+ r = "function" == typeof Symbol ? Symbol : {},
55
+ n = r.iterator || "@@iterator",
56
+ o = r.toStringTag || "@@toStringTag";
57
+ function i(r, n, o, i) {
58
+ var c = n && n.prototype instanceof Generator ? n : Generator,
59
+ u = Object.create(c.prototype);
60
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
61
+ var i,
62
+ c,
63
+ u,
64
+ f = 0,
65
+ p = o || [],
66
+ y = !1,
67
+ G = {
68
+ p: 0,
69
+ n: 0,
70
+ v: e,
71
+ a: d,
72
+ f: d.bind(e, 4),
73
+ d: function (t, r) {
74
+ return i = t, c = 0, u = e, G.n = r, a;
75
+ }
76
+ };
77
+ function d(r, n) {
78
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
79
+ var o,
80
+ i = p[t],
81
+ d = G.p,
82
+ l = i[2];
83
+ 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));
150
84
  }
151
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
85
+ if (o || r > 1) return a;
86
+ throw y = !0, n;
152
87
  }
153
- });
154
- }
155
- function makeInvokeMethod(e, r, n) {
156
- var o = h;
157
- return function (i, a) {
158
- if (o === f) throw Error("Generator is already running");
159
- if (o === s) {
160
- if ("throw" === i) throw a;
88
+ return function (o, p, l) {
89
+ if (f > 1) throw TypeError("Generator is already running");
90
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
91
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
92
+ try {
93
+ if (f = 2, i) {
94
+ if (c || (o = "next"), t = i[o]) {
95
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
96
+ if (!t.done) return t;
97
+ u = t.value, c < 2 && (c = 0);
98
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
99
+ i = e;
100
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
101
+ } catch (t) {
102
+ i = e, c = 1, u = t;
103
+ } finally {
104
+ f = 1;
105
+ }
106
+ }
161
107
  return {
162
108
  value: t,
163
- done: !0
109
+ done: y
164
110
  };
165
- }
166
- for (n.method = i, n.arg = a;;) {
167
- var c = n.delegate;
168
- if (c) {
169
- var u = maybeInvokeDelegate(c, n);
170
- if (u) {
171
- if (u === y) continue;
172
- return u;
173
- }
174
- }
175
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
176
- if (o === h) throw o = s, n.arg;
177
- n.dispatchException(n.arg);
178
- } else "return" === n.method && n.abrupt("return", n.arg);
179
- o = f;
180
- var p = tryCatch(e, r, n);
181
- if ("normal" === p.type) {
182
- if (o = n.done ? s : l, p.arg === y) continue;
183
- return {
184
- value: p.arg,
185
- done: n.done
186
- };
187
- }
188
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
189
- }
190
- };
191
- }
192
- function maybeInvokeDelegate(e, r) {
193
- var n = r.method,
194
- o = e.iterator[n];
195
- 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;
196
- var i = tryCatch(o, e.iterator, r.arg);
197
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
198
- var a = i.arg;
199
- 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);
200
- }
201
- function pushTryEntry(t) {
202
- var e = {
203
- tryLoc: t[0]
204
- };
205
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
206
- }
207
- function resetTryEntry(t) {
208
- var e = t.completion || {};
209
- e.type = "normal", delete e.arg, t.completion = e;
210
- }
211
- function Context(t) {
212
- this.tryEntries = [{
213
- tryLoc: "root"
214
- }], t.forEach(pushTryEntry, this), this.reset(!0);
111
+ };
112
+ }(r, o, i), !0), u;
215
113
  }
216
- function values(e) {
217
- if (e || "" === e) {
218
- var r = e[a];
219
- if (r) return r.call(e);
220
- if ("function" == typeof e.next) return e;
221
- if (!isNaN(e.length)) {
222
- var o = -1,
223
- i = function next() {
224
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
225
- return next.value = t, next.done = !0, next;
226
- };
227
- return i.next = i;
228
- }
229
- }
230
- throw new TypeError(typeof e + " is not iterable");
114
+ var a = {};
115
+ function Generator() {}
116
+ function GeneratorFunction() {}
117
+ function GeneratorFunctionPrototype() {}
118
+ t = Object.getPrototypeOf;
119
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
120
+ return this;
121
+ }), t),
122
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
123
+ function f(e) {
124
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
231
125
  }
232
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
233
- value: GeneratorFunctionPrototype,
234
- configurable: !0
235
- }), o(GeneratorFunctionPrototype, "constructor", {
236
- value: GeneratorFunction,
237
- configurable: !0
238
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
239
- var e = "function" == typeof t && t.constructor;
240
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
241
- }, e.mark = function (t) {
242
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
243
- }, e.awrap = function (t) {
244
- return {
245
- __await: t
246
- };
247
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
126
+ 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 () {
248
127
  return this;
249
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
250
- void 0 === i && (i = Promise);
251
- var a = new AsyncIterator(wrap(t, r, n, o), i);
252
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
253
- return t.done ? t.value : a.next();
254
- });
255
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
256
- return this;
257
- }), define(g, "toString", function () {
128
+ }), _regeneratorDefine(u, "toString", function () {
258
129
  return "[object Generator]";
259
- }), e.keys = function (t) {
260
- var e = Object(t),
261
- r = [];
262
- for (var n in e) r.push(n);
263
- return r.reverse(), function next() {
264
- for (; r.length;) {
265
- var t = r.pop();
266
- if (t in e) return next.value = t, next.done = !1, next;
267
- }
268
- return next.done = !0, next;
130
+ }), (_regenerator = function () {
131
+ return {
132
+ w: i,
133
+ m: f
269
134
  };
270
- }, e.values = values, Context.prototype = {
271
- constructor: Context,
272
- reset: function (e) {
273
- 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);
274
- },
275
- stop: function () {
276
- this.done = !0;
277
- var t = this.tryEntries[0].completion;
278
- if ("throw" === t.type) throw t.arg;
279
- return this.rval;
280
- },
281
- dispatchException: function (e) {
282
- if (this.done) throw e;
283
- var r = this;
284
- function handle(n, o) {
285
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
286
- }
287
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
288
- var i = this.tryEntries[o],
289
- a = i.completion;
290
- if ("root" === i.tryLoc) return handle("end");
291
- if (i.tryLoc <= this.prev) {
292
- var c = n.call(i, "catchLoc"),
293
- u = n.call(i, "finallyLoc");
294
- if (c && u) {
295
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
296
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
297
- } else if (c) {
298
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
299
- } else {
300
- if (!u) throw Error("try statement without catch or finally");
301
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
302
- }
303
- }
304
- }
305
- },
306
- abrupt: function (t, e) {
307
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
308
- var o = this.tryEntries[r];
309
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
310
- var i = o;
311
- break;
312
- }
313
- }
314
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
315
- var a = i ? i.completion : {};
316
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
317
- },
318
- complete: function (t, e) {
319
- if ("throw" === t.type) throw t.arg;
320
- 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;
321
- },
322
- finish: function (t) {
323
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
324
- var r = this.tryEntries[e];
325
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
326
- }
327
- },
328
- catch: function (t) {
329
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
330
- var r = this.tryEntries[e];
331
- if (r.tryLoc === t) {
332
- var n = r.completion;
333
- if ("throw" === n.type) {
334
- var o = n.arg;
335
- resetTryEntry(r);
336
- }
337
- return o;
338
- }
339
- }
340
- throw Error("illegal catch attempt");
341
- },
342
- delegateYield: function (e, r, n) {
343
- return this.delegate = {
344
- iterator: values(e),
345
- resultName: r,
346
- nextLoc: n
347
- }, "next" === this.method && (this.arg = t), y;
135
+ })();
136
+ }
137
+ function _regeneratorDefine(e, r, n, t) {
138
+ var i = Object.defineProperty;
139
+ try {
140
+ i({}, "", {});
141
+ } catch (e) {
142
+ i = 0;
143
+ }
144
+ _regeneratorDefine = function (e, r, n, t) {
145
+ function o(r, n) {
146
+ _regeneratorDefine(e, r, function (e) {
147
+ return this._invoke(r, n, e);
148
+ });
348
149
  }
349
- }, e;
150
+ r ? i ? i(e, r, {
151
+ value: n,
152
+ enumerable: !t,
153
+ configurable: !t,
154
+ writable: !t
155
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
156
+ }, _regeneratorDefine(e, r, n, t);
350
157
  }
351
158
 
352
159
  var _excluded = ["table", "children"];
@@ -360,43 +167,40 @@ function AirtableRecord(_ref) {
360
167
  var dataSourceId = credentialsContext && credentialsContext.id;
361
168
  var base = credentialsContext && credentialsContext.base;
362
169
  var host = credentialsContext && credentialsContext.host || defaultHost;
363
- var data = usePlasmicQueryData(JSON.stringify(["AirtableRecord", host, base, table, record, dataSourceId]), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
170
+ var data = usePlasmicQueryData(JSON.stringify(["AirtableRecord", host, base, table, record, dataSourceId]), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
364
171
  var pathname, url;
365
- return _regeneratorRuntime().wrap(function _callee$(_context) {
366
- while (1) switch (_context.prev = _context.next) {
172
+ return _regenerator().w(function (_context) {
173
+ while (1) switch (_context.n) {
367
174
  case 0:
368
175
  if (!(!base || !dataSourceId)) {
369
- _context.next = 2;
176
+ _context.n = 1;
370
177
  break;
371
178
  }
372
179
  throw new Error("Missing Data Source. Please select a Data Source from the Airtable Credentials Provider");
373
- case 2:
180
+ case 1:
374
181
  if (table) {
375
- _context.next = 4;
182
+ _context.n = 2;
376
183
  break;
377
184
  }
378
185
  throw new Error("AirtableRecord is missing the table name");
379
- case 4:
186
+ case 2:
380
187
  if (record) {
381
- _context.next = 6;
188
+ _context.n = 3;
382
189
  break;
383
190
  }
384
191
  throw new Error("AirtableRecord is missing the record ID");
385
- case 6:
192
+ case 3:
386
193
  pathname = "/" + base + "/" + table + "/" + record;
387
194
  url = host + "/api/v1/server-data/query?pathname=" + encodeURIComponent(pathname) + "&dataSourceId=" + dataSourceId;
388
- _context.next = 10;
195
+ _context.n = 4;
389
196
  return fetch(url, {
390
197
  method: "GET"
391
198
  });
392
- case 10:
393
- _context.next = 12;
394
- return _context.sent.json();
395
- case 12:
396
- return _context.abrupt("return", _context.sent.fields);
397
- case 13:
398
- case "end":
399
- return _context.stop();
199
+ case 4:
200
+ _context.n = 5;
201
+ return _context.v.json();
202
+ case 5:
203
+ return _context.a(2, _context.v.fields);
400
204
  }
401
205
  }, _callee);
402
206
  })));
@@ -462,37 +266,34 @@ function AirtableCollection(_ref4) {
462
266
  });
463
267
  }
464
268
  var search = searchArray.length === 0 ? "" : "?" + searchArray.join("&");
465
- var _usePlasmicQueryData = usePlasmicQueryData(JSON.stringify(["AirtableCollection", host, base, table, search, dataSourceId]), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
269
+ var _usePlasmicQueryData = usePlasmicQueryData(JSON.stringify(["AirtableCollection", host, base, table, search, dataSourceId]), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
466
270
  var pathname, url;
467
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
468
- while (1) switch (_context2.prev = _context2.next) {
271
+ return _regenerator().w(function (_context2) {
272
+ while (1) switch (_context2.n) {
469
273
  case 0:
470
274
  if (!(!base || !dataSourceId)) {
471
- _context2.next = 2;
275
+ _context2.n = 1;
472
276
  break;
473
277
  }
474
278
  throw new Error("Missing Data Source. Please select a Data Source from the Airtable Credentials Provider");
475
- case 2:
279
+ case 1:
476
280
  if (table) {
477
- _context2.next = 4;
281
+ _context2.n = 2;
478
282
  break;
479
283
  }
480
284
  throw new Error("AirtableCollection is missing the table name");
481
- case 4:
285
+ case 2:
482
286
  pathname = "/" + base + "/" + table + search;
483
287
  url = host + "/api/v1/server-data/query?pathname=" + encodeURIComponent(pathname) + "&dataSourceId=" + dataSourceId;
484
- _context2.next = 8;
288
+ _context2.n = 3;
485
289
  return fetch(url, {
486
290
  method: "GET"
487
291
  });
488
- case 8:
489
- _context2.next = 10;
490
- return _context2.sent.json();
491
- case 10:
492
- return _context2.abrupt("return", _context2.sent.records);
493
- case 11:
494
- case "end":
495
- return _context2.stop();
292
+ case 3:
293
+ _context2.n = 4;
294
+ return _context2.v.json();
295
+ case 4:
296
+ return _context2.a(2, _context2.v.records);
496
297
  }
497
298
  }, _callee2);
498
299
  }))),
@@ -1 +1 @@
1
- {"version":3,"file":"airtable.esm.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,IAAI,GAAIL,kBAAkB,IAAIA,kBAAkB,CAACK,IAAI,IAAKf,WAAW;EAE3E,I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C1C;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.esm.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,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;EAER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