@embeddable.com/sdk-react 3.10.12-next.0 → 3.10.13-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/build.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- declare const _default: (ctx: any) => Promise<import("rollup").RollupOutput | import("rollup").RollupOutput[] | import("rollup").RollupWatcher>;
1
+ import { ResolvedEmbeddableConfig } from "@embeddable.com/sdk-core";
2
+ declare const _default: (ctx: ResolvedEmbeddableConfig) => Promise<import("rollup").RollupOutput | import("rollup").RollupOutput[] | import("rollup").RollupWatcher>;
2
3
  export default _default;
package/lib/cleanup.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- declare const _default: (ctx: any) => Promise<void>;
1
+ import { ResolvedEmbeddableConfig } from "@embeddable.com/sdk-core";
2
+ declare const _default: (ctx: ResolvedEmbeddableConfig) => Promise<void>;
2
3
  export default _default;
@@ -1,2 +1,3 @@
1
- declare const _default: (pluginRoot: string, coreCtx: any) => void;
1
+ import { ResolvedEmbeddableConfig } from "@embeddable.com/sdk-core";
2
+ declare const _default: (pluginRoot: string, coreCtx: ResolvedEmbeddableConfig) => void;
2
3
  export default _default;
package/lib/generate.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import * as vite from "vite";
2
- declare const _default: (ctx: any) => Promise<vite.Rollup.RollupOutput | vite.Rollup.RollupOutput[] | vite.Rollup.RollupWatcher>;
2
+ import { ResolvedEmbeddableConfig } from "@embeddable.com/sdk-core";
3
+ declare const _default: (ctx: ResolvedEmbeddableConfig) => Promise<vite.Rollup.RollupOutput | vite.Rollup.RollupOutput[] | vite.Rollup.RollupWatcher>;
3
4
  export default _default;
package/lib/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  declare const _default: () => {
2
2
  pluginName: string;
3
3
  validate: () => Promise<void>;
4
- build: (ctx: any) => Promise<import("rollup").RollupOutput | import("rollup").RollupOutput[] | import("rollup").RollupWatcher>;
5
- cleanup: (ctx: any) => Promise<void>;
4
+ build: (ctx: import("@embeddable.com/sdk-core").ResolvedEmbeddableConfig) => Promise<import("rollup").RollupOutput | import("rollup").RollupOutput[] | import("rollup").RollupWatcher>;
5
+ cleanup: (ctx: import("@embeddable.com/sdk-core").ResolvedEmbeddableConfig) => Promise<void>;
6
6
  };
7
7
  export default _default;
package/lib/index.esm.js CHANGED
@@ -172,6 +172,9 @@ const ZodIssueCode = util.arrayToEnum([
172
172
  "not_finite",
173
173
  ]);
174
174
  class ZodError extends Error {
175
+ get errors() {
176
+ return this.issues;
177
+ }
175
178
  constructor(issues) {
176
179
  super();
177
180
  this.issues = [];
@@ -192,9 +195,6 @@ class ZodError extends Error {
192
195
  this.name = "ZodError";
193
196
  this.issues = issues;
194
197
  }
195
- get errors() {
196
- return this.issues;
197
- }
198
198
  format(_mapper) {
199
199
  const mapper = _mapper ||
200
200
  function (issue) {
@@ -423,59 +423,27 @@ globalThis.__EMBEDDABLE__.${globalKey} = globalThis.__EMBEDDABLE__.${globalKey}
423
423
  };
424
424
  };
425
425
 
426
- /******************************************************************************
427
- Copyright (c) Microsoft Corporation.
428
-
429
- Permission to use, copy, modify, and/or distribute this software for any
430
- purpose with or without fee is hereby granted.
431
-
432
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
433
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
434
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
435
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
436
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
437
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
438
- PERFORMANCE OF THIS SOFTWARE.
439
- ***************************************************************************** */
440
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
441
-
442
-
443
- var __assign = function() {
444
- __assign = Object.assign || function __assign(t) {
445
- for (var s, i = 1, n = arguments.length; i < n; i++) {
446
- s = arguments[i];
447
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
448
- }
449
- return t;
450
- };
451
- return __assign.apply(this, arguments);
452
- };
453
-
454
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
455
- var e = new Error(message);
456
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
457
- };
458
-
459
- var DEFAULT_LOCALE = "en-US";
460
- var createBuiltInType = function (name, typeConfig) {
461
- if (typeConfig === undefined) { typeConfig = {}; }
462
- return ({
463
- __embeddableType: "built-in",
464
- toString: function () { return name; },
465
- typeConfig: __assign({ label: name, optionLabel: function () { return name; } }, typeConfig),
466
- });
467
- };
468
- var STRING = "string";
469
- var NUMBER = "number";
470
- var BOOLEAN = "boolean";
471
- var TIME = "time";
472
- var TIME_RANGE = "timeRange";
473
- var GRANULARITY = "granularity";
474
- var DATASET = "dataset";
475
- var MEASURE = "measure";
476
- var DIMENSION = "dimension";
477
- var DIMENSION_OR_MEASURE = "dimensionOrMeasure";
478
- var ALL_NATIVE_TYPES = [
426
+ const DEFAULT_LOCALE = "en-US";
427
+ const createBuiltInType = (name, typeConfig = {}) => ({
428
+ __embeddableType: "built-in",
429
+ toString: () => name,
430
+ typeConfig: {
431
+ label: name,
432
+ optionLabel: () => name,
433
+ ...typeConfig,
434
+ },
435
+ });
436
+ const STRING = "string";
437
+ const NUMBER = "number";
438
+ const BOOLEAN = "boolean";
439
+ const TIME = "time";
440
+ const TIME_RANGE = "timeRange";
441
+ const GRANULARITY = "granularity";
442
+ const DATASET = "dataset";
443
+ const MEASURE = "measure";
444
+ const DIMENSION = "dimension";
445
+ const DIMENSION_OR_MEASURE = "dimensionOrMeasure";
446
+ const ALL_NATIVE_TYPES = [
479
447
  STRING,
480
448
  NUMBER,
481
449
  BOOLEAN,
@@ -489,74 +457,68 @@ var ALL_NATIVE_TYPES = [
489
457
  ];
490
458
 
491
459
  createBuiltInType("string", {
492
- transform: function (value) { return value; },
493
- optionLabel: function (value) {
494
- return Array.isArray(value)
495
- ? "[".concat(value.map(function (v) { return "\"".concat(v, "\""); }).join(","), "]")
496
- : "\"".concat(value, "\"");
497
- },
460
+ transform: (value) => value,
461
+ optionLabel: (value) => Array.isArray(value)
462
+ ? `[${value.map((v) => `"${v}"`).join(",")}]`
463
+ : `"${value}"`,
498
464
  });
499
465
  createBuiltInType("number", {
500
- transform: function (value) {
501
- return Array.isArray(value) ? value : value ? Number(value) : value;
502
- },
503
- optionLabel: function (value) {
504
- var _a;
505
- return Array.isArray(value)
506
- ? "[".concat(value.join(","), "]")
507
- : ((_a = value === null || value === undefined ? undefined : value.toLocaleString(DEFAULT_LOCALE)) !== null && _a !== undefined ? _a : "");
508
- },
466
+ transform: (value) => Array.isArray(value) ? value : value ? Number(value) : value,
467
+ optionLabel: (value) => Array.isArray(value)
468
+ ? `[${value.join(",")}]`
469
+ : (value?.toLocaleString(DEFAULT_LOCALE) ?? ""),
509
470
  });
510
471
  createBuiltInType("boolean", {
511
- transform: function (value) { return value === "true" || value === true; },
512
- optionLabel: function (value) { return (value ? "true" : "false"); },
472
+ transform: (value) => value === "true" || value === true,
473
+ optionLabel: (value) => (value ? "true" : "false"),
513
474
  });
514
475
  createBuiltInType("time", {
515
- transform: function (value) {
516
- var date = (value === null || value === undefined ? undefined : value.date) ? new Date(value.date) : undefined;
517
- var isValid = date && date.toString() !== "Invalid Date";
476
+ transform: (value) => {
477
+ const date = value?.date ? new Date(value.date) : undefined;
478
+ const isValid = date && date.toString() !== "Invalid Date";
518
479
  return {
519
480
  date: isValid ? date : undefined,
520
- relativeTimeString: value === null || value === undefined ? undefined : value.relativeTimeString,
481
+ relativeTimeString: value?.relativeTimeString,
521
482
  };
522
483
  },
523
- optionLabel: function (value) {
524
- var _a, _b;
484
+ optionLabel: (value) => {
525
485
  if (!value)
526
486
  return "";
527
- if (value === null || value === undefined ? undefined : value.date) {
528
- return ((_b = (_a = value.date) === null || _a === undefined ? undefined : _a.toLocaleDateString(DEFAULT_LOCALE)) !== null && _b !== undefined ? _b : value.date.toLocaleString());
487
+ if (value?.date) {
488
+ return (value.date?.toLocaleDateString(DEFAULT_LOCALE) ??
489
+ value.date.toLocaleString());
529
490
  }
530
491
  return value.relativeTimeString;
531
492
  },
532
493
  });
533
494
  createBuiltInType("timeRange", {
534
- transform: function (value) {
495
+ transform: (value) => {
535
496
  // Return undefined instead of a null populated object
536
497
  if (!value)
537
498
  return undefined;
538
- var _a = [value === null || value === undefined ? undefined : value.from, value === null || value === undefined ? undefined : value.to], from = _a[0], to = _a[1];
539
- var fromDate = new Date(from);
540
- var toDate = new Date(to);
499
+ const [from, to] = [value?.from, value?.to];
500
+ const fromDate = new Date(from);
501
+ const toDate = new Date(to);
541
502
  return {
542
503
  from: fromDate.toString() !== "Invalid Date" ? fromDate : undefined,
543
504
  to: toDate.toString() !== "Invalid Date" ? toDate : undefined,
544
- relativeTimeString: value === null || value === undefined ? undefined : value.relativeTimeString,
505
+ relativeTimeString: value?.relativeTimeString,
545
506
  };
546
507
  },
547
- optionLabel: function (value) {
548
- var _a, _b, _c, _d, _e, _f;
508
+ optionLabel: (value) => {
549
509
  if (!value)
550
510
  return "";
551
- if ((value === null || value === undefined ? undefined : value.from) && (value === null || value === undefined ? undefined : value.to)) {
552
- return "".concat((_b = (_a = value.from) === null || _a === undefined ? undefined : _a.toLocaleDateString(DEFAULT_LOCALE)) !== null && _b !== undefined ? _b : (_c = value.from) === null || _c === undefined ? undefined : _c.toLocaleString(), ",").concat((_e = (_d = value.to) === null || _d === undefined ? undefined : _d.toLocaleDateString(DEFAULT_LOCALE)) !== null && _e !== undefined ? _e : (_f = value.to) === null || _f === undefined ? undefined : _f.toLocaleString());
511
+ if (value?.from && value?.to) {
512
+ return `${value.from?.toLocaleDateString(DEFAULT_LOCALE) ??
513
+ value.from?.toLocaleString()},${value.to?.toLocaleDateString(DEFAULT_LOCALE) ??
514
+ value.to?.toLocaleString()}`;
553
515
  }
554
- return value === null || value === undefined ? undefined : value.relativeTimeString;
516
+ return value?.relativeTimeString;
555
517
  },
556
518
  });
557
519
  createBuiltInType("granularity", {
558
- transform: function (value) { return value; },
559
- optionLabel: function (value) { return value; },
520
+ transform: (value) => value,
521
+ optionLabel: (value) => value,
560
522
  });
561
523
  createBuiltInType("dataset");
562
524
  createBuiltInType("measure");