@datadog/apps-frontend 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +38 -5
  2. package/dist/src/_chunks/chunk-3UFPUAWY.js +7 -0
  3. package/dist/src/_chunks/chunk-3UFPUAWY.js.map +7 -0
  4. package/dist/src/_chunks/chunk-627KNBXP.js +7 -0
  5. package/dist/src/_chunks/chunk-627KNBXP.js.map +7 -0
  6. package/dist/src/_chunks/{chunk-T34NWJ7R.js → chunk-G2SXTUX4.js} +2 -2
  7. package/dist/src/_chunks/chunk-G2SXTUX4.js.map +7 -0
  8. package/dist/src/_chunks/{chunk-X34MSTJH.js → chunk-LEEYMNMO.js} +2 -2
  9. package/dist/src/_chunks/{chunk-X34MSTJH.js.map → chunk-LEEYMNMO.js.map} +3 -3
  10. package/dist/src/_chunks/chunk-MF7HCOXQ.js +7 -0
  11. package/dist/src/_chunks/chunk-MF7HCOXQ.js.map +7 -0
  12. package/dist/src/_chunks/chunk-PA4Z7DNH.js +7 -0
  13. package/dist/src/_chunks/chunk-PA4Z7DNH.js.map +7 -0
  14. package/dist/src/_chunks/chunk-QOXXZE7D.js +7 -0
  15. package/dist/src/_chunks/chunk-QOXXZE7D.js.map +7 -0
  16. package/dist/src/_chunks/chunk-VVRISDII.js +7 -0
  17. package/dist/src/_chunks/chunk-VVRISDII.js.map +7 -0
  18. package/dist/src/apps-provider.d.ts +51 -0
  19. package/dist/src/deep-links/react/index.d.ts +18 -0
  20. package/dist/src/deep-links/react/index.js +7 -0
  21. package/dist/src/deep-links/react/index.js.map +7 -0
  22. package/dist/src/druids/react/druids-environment-with-theme-input.d.ts +46 -0
  23. package/dist/src/druids/react/index.d.ts +7 -0
  24. package/dist/src/druids/react/index.js +7 -0
  25. package/dist/src/druids/react/index.js.map +7 -0
  26. package/dist/src/embedding/react/config.d.ts +62 -0
  27. package/dist/src/embedding/react/index.d.ts +2 -0
  28. package/dist/src/embedding/react/index.js +1 -1
  29. package/dist/src/embedding/react/index.js.map +4 -4
  30. package/dist/src/embedding/react/provider.d.ts +36 -2
  31. package/dist/src/embedding/types.d.ts +2 -3
  32. package/dist/src/index.d.ts +2 -1
  33. package/dist/src/index.js +1 -0
  34. package/dist/src/index.js.map +4 -4
  35. package/dist/src/inputs/published-definition.d.ts +5 -1
  36. package/dist/src/inputs/react/index.js +1 -1
  37. package/dist/src/inputs/react/index.js.map +4 -4
  38. package/dist/src/inputs/schemas/index.js +1 -1
  39. package/dist/src/inputs/schemas/index.js.map +4 -4
  40. package/package.json +24 -1
  41. package/dist/src/_chunks/chunk-T34NWJ7R.js.map +0 -7
@@ -4,5 +4,39 @@
4
4
  */
5
5
 
6
6
  import type { ComponentType, PropsWithChildren } from 'react';
7
- /** Owns the shared embedding connection for all descendant Datadog App hooks. */
8
- export declare const DatadogAppProvider: ComponentType<PropsWithChildren>;
7
+ import type { DatadogAppProviderModule } from './config.js';
8
+ export interface DatadogAppProviderProps extends PropsWithChildren {
9
+ /**
10
+ * Capability modules to install on this mount, in list order. Read once
11
+ * per mount: modules are startup configuration, so a later change to
12
+ * this prop is ignored -- remount the provider to change modules. (The
13
+ * common inline form, `modules={[resizing(...)]}`, builds a fresh array
14
+ * every render; installs deliberately do not track it.)
15
+ */
16
+ readonly modules?: readonly DatadogAppProviderModule[];
17
+ }
18
+ /**
19
+ * Owns the shared embedding connection and installs capability modules.
20
+ *
21
+ * On each mount, every listed module's `install` runs once, in list order,
22
+ * receiving the shared connection and this mount's dispose signal (aborted on
23
+ * unmount, so modules clean up). A failing install is reported and isolated;
24
+ * the remaining modules and the app still run. Installs happen after this
25
+ * provider's children have mounted, and modules have no render rights, so no
26
+ * child can observe module state during its own mount.
27
+ *
28
+ * Sibling mounts (independent subtrees, each with its own
29
+ * `DatadogAppProvider`) are supported: every mount from the same loaded
30
+ * copy of this package shares one underlying embedding connection
31
+ * (ref-counted -- the wire connection opens on the first mount and closes on
32
+ * the last unmount) and one `ClaimStore` per contract (claims for the same
33
+ * contract are never duplicated on the wire), while each mount installs its
34
+ * own `modules` independently, each module receiving its own mount's dispose
35
+ * signal.
36
+ *
37
+ * Nesting one `DatadogAppProvider` inside another's subtree is NOT
38
+ * supported and should be avoided. The connection/claim sharing above still
39
+ * holds, but there is no cross-provider dedup of modules: a module installed
40
+ * by both providers installs -- and its effects run -- once per provider.
41
+ */
42
+ export declare const DatadogAppProvider: ComponentType<DatadogAppProviderProps>;
@@ -191,9 +191,8 @@ export interface AppConnection {
191
191
  /**
192
192
  * Identifies which product surface a Datadog App is embedded into (e.g. the
193
193
  * Service Catalog side panel vs. IDP), so an app can render surface-specific
194
- * content. Each value matches the `identifier` of the inputs schema that
195
- * surface provides -- see `../inputs/schemas`. Sent host-to-app as part of
196
- * the embedding connection handshake.
194
+ * content. Each value matches the identifier of the schema that surface
195
+ * provides. Sent host-to-app as part of the embedding connection handshake.
197
196
  */
198
197
  /**
199
198
  * Every surface, as a tuple rather than a bare union so it can also serve as a
@@ -3,4 +3,5 @@
3
3
  * Copyright 2019-Present Datadog, Inc.
4
4
  */
5
5
 
6
- export {};
6
+ export { DatadogAppsProvider } from './apps-provider.js';
7
+ export type { DatadogAppsProviderProps, DefaultDatadogAppModuleId, } from './apps-provider.js';
package/dist/src/index.js CHANGED
@@ -3,4 +3,5 @@
3
3
  * Copyright 2019-Present Datadog, Inc.
4
4
  */
5
5
 
6
+ import{a as s}from"./_chunks/chunk-VVRISDII.js";import{a as n}from"./_chunks/chunk-3UFPUAWY.js";import"./_chunks/chunk-MF7HCOXQ.js";import"./_chunks/chunk-2V2HASKF.js";import"./_chunks/chunk-PA4Z7DNH.js";import"./_chunks/chunk-LEEYMNMO.js";import{createElement as u,useState as g}from"react";var m=Object.freeze([n()]);function D(d){try{console.warn(d)}catch{}}function c(d,t,a){let o=t??[],l=new Set(o.map(e=>e.id)),r=new Set(a??[]),i=d.filter(e=>!r.has(e.id)&&!l.has(e.id));if(r.size===0)return[...i,...o];for(let e of o)if(r.has(e.id))throw new Error(`DatadogAppsProvider received module "${e.id}" in both modules and disabledModules.`);for(let e of r)d.some(p=>p.id===e)||o.some(p=>p.id===e)||D(`[Datadog Apps provider] disabledModules names "${e}", but no module with that id is installed.`);return[...i,...o]}var f=({children:d,modules:t,disabledModules:a})=>{let[o]=g(()=>c(m,t,a));return u(s,{modules:o},d)};export{f as DatadogAppsProvider};
6
7
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
3
+ "sources": ["../../src/apps-provider.ts"],
4
+ "sourcesContent": ["import { createElement, useState } from 'react';\nimport type { ComponentType, PropsWithChildren, ReactElement } from 'react';\n\nimport { datadogAppDeepLinks } from './deep-links/react';\nimport type { DatadogAppProviderModule } from './embedding/react/config';\nimport { DatadogAppProvider } from './embedding/react/provider';\n\n/**\n * The ids of this package's default modules, exactly as app authors may name\n * them in `disabledModules`. Publishing a module's id here is half of\n * promoting it to a default; the other half is its entry in DEFAULT_MODULES\n * directly below. The two cannot drift silently: DEFAULT_MODULES only accepts\n * modules whose ids appear here, so a promoted entry without its id is a\n * compile error. Deep links is the first (and so far only) default.\n */\nexport type DefaultDatadogAppModuleId = 'datadog.deep-links';\n\n/**\n * Modules this provider installs by default, in list order (before any\n * explicitly requested ones).\n *\n * This composite provider, not the embedding core, owns the default set: the\n * core stays module-agnostic and never resolves a module id. A module package\n * lands in this list when it is promoted to a default.\n *\n * Deep links: mirrors the app's query and fragment state onto the embedding\n * host's page URL so navigations become shareable links. Inert without a host-side\n * deep-links counterpart (the claim stays pending), so defaulting it is safe\n * on every surface regardless of host wiring. Disable with\n * `disabledModules={['datadog.deep-links']}` or pass a configured\n * `datadogAppDeepLinks()` instance explicitly to replace it.\n */\nconst DEFAULT_MODULES: readonly DatadogAppProviderModule<DefaultDatadogAppModuleId>[] =\n Object.freeze([datadogAppDeepLinks()]);\n\n/** Applies to `disabledModules` only; explicitly passed modules win. */\nfunction warn(message: string): void {\n try {\n console.warn(message);\n } catch {\n // A hostile console implementation must never break rendering.\n }\n}\n\n/**\n * Merges default and explicitly requested modules into the list the core\n * provider installs.\n *\n * `disabledModules` excludes defaults; passing a module explicitly and\n * disabling its id in the same config is a contradiction and throws. Disabling\n * an id that is neither a default nor explicitly requested warns: the id is\n * stale (removed from a later package) or misspelled, and a frozen app must\n * keep rendering rather than fail on it.\n *\n * A default and an explicitly requested module with the same id is not a\n * duplicate: the explicit instance wins. An app compiled before a module was\n * promoted to a default, requesting it explicitly, keeps working after the\n * promotion.\n */\nexport function mergeDatadogAppsProviderModules(\n defaults: readonly DatadogAppProviderModule[],\n requested: readonly DatadogAppProviderModule[] | undefined,\n disabled: readonly string[] | undefined,\n): readonly DatadogAppProviderModule[] {\n const explicit = requested ?? [];\n const explicitIds = new Set(explicit.map((module) => module.id));\n const disabledIds = new Set(disabled ?? []);\n const survivingDefaults = defaults.filter(\n (module) => !disabledIds.has(module.id) && !explicitIds.has(module.id),\n );\n if (disabledIds.size === 0) {\n return [...survivingDefaults, ...explicit];\n }\n for (const module of explicit) {\n if (disabledIds.has(module.id)) {\n throw new Error(\n `DatadogAppsProvider received module \"${module.id}\" in both modules and disabledModules.`,\n );\n }\n }\n for (const id of disabledIds) {\n const isKnown =\n defaults.some((module) => module.id === id) ||\n explicit.some((module) => module.id === id);\n if (!isKnown) {\n warn(\n `[Datadog Apps provider] disabledModules names \"${id}\", but no module with that id is installed.`,\n );\n }\n }\n return [...survivingDefaults, ...explicit];\n}\n\nexport interface DatadogAppsProviderProps extends PropsWithChildren {\n /** Modules to install in addition to the defaults, in list order. */\n readonly modules?: readonly DatadogAppProviderModule[];\n /**\n * Ids of default modules to exclude from this provider. The accepted\n * names are exactly the package's default modules, so a misspelled id is\n * a compile error; at runtime an unknown id still only warns, so a frozen\n * app compiled against an older default set keeps rendering.\n */\n readonly disabledModules?: readonly DefaultDatadogAppModuleId[];\n}\n\n/**\n * The distribution-level Datadog App provider: installs this package's\n * default modules (deep links today), merges in explicitly requested ones, honors\n * `disabledModules`, and delegates to the module-agnostic\n * {@link DatadogAppProvider}. App authors normally mount this one\n * component.\n */\nexport const DatadogAppsProvider: ComponentType<DatadogAppsProviderProps> = ({\n children,\n modules,\n disabledModules,\n}: DatadogAppsProviderProps): ReactElement => {\n const [installed] = useState(() =>\n mergeDatadogAppsProviderModules(\n DEFAULT_MODULES,\n modules,\n disabledModules,\n ),\n );\n return createElement(DatadogAppProvider, { modules: installed }, children);\n};\n"],
5
+ "mappings": "gPAAA,OAAS,iBAAAA,EAAe,YAAAC,MAAgB,QAgCxC,IAAMC,EACF,OAAO,OAAO,CAACC,EAAoB,CAAC,CAAC,EAGzC,SAASC,EAAKC,EAAuB,CACjC,GAAI,CACA,QAAQ,KAAKA,CAAO,CACxB,MAAQ,CAER,CACJ,CAiBO,SAASC,EACZC,EACAC,EACAC,EACmC,CACnC,IAAMC,EAAWF,GAAa,CAAC,EACzBG,EAAc,IAAI,IAAID,EAAS,IAAKE,GAAWA,EAAO,EAAE,CAAC,EACzDC,EAAc,IAAI,IAAIJ,GAAY,CAAC,CAAC,EACpCK,EAAoBP,EAAS,OAC9BK,GAAW,CAACC,EAAY,IAAID,EAAO,EAAE,GAAK,CAACD,EAAY,IAAIC,EAAO,EAAE,CACzE,EACA,GAAIC,EAAY,OAAS,EACrB,MAAO,CAAC,GAAGC,EAAmB,GAAGJ,CAAQ,EAE7C,QAAWE,KAAUF,EACjB,GAAIG,EAAY,IAAID,EAAO,EAAE,EACzB,MAAM,IAAI,MACN,wCAAwCA,EAAO,EAAE,wCACrD,EAGR,QAAWG,KAAMF,EAETN,EAAS,KAAMK,GAAWA,EAAO,KAAOG,CAAE,GAC1CL,EAAS,KAAME,GAAWA,EAAO,KAAOG,CAAE,GAE1CX,EACI,kDAAkDW,CAAE,6CACxD,EAGR,MAAO,CAAC,GAAGD,EAAmB,GAAGJ,CAAQ,CAC7C,CAqBO,IAAMM,EAA+D,CAAC,CACzE,SAAAC,EACA,QAAAC,EACA,gBAAAC,CACJ,IAA8C,CAC1C,GAAM,CAACC,CAAS,EAAIC,EAAS,IACzBf,EACIJ,EACAgB,EACAC,CACJ,CACJ,EACA,OAAOG,EAAcC,EAAoB,CAAE,QAASH,CAAU,EAAGH,CAAQ,CAC7E",
6
+ "names": ["createElement", "useState", "DEFAULT_MODULES", "datadogAppDeepLinks", "warn", "message", "mergeDatadogAppsProviderModules", "defaults", "requested", "disabled", "explicit", "explicitIds", "module", "disabledIds", "survivingDefaults", "id", "DatadogAppsProvider", "children", "modules", "disabledModules", "installed", "useState", "createElement", "DatadogAppProvider"]
7
7
  }
@@ -26,6 +26,10 @@ export type AnyDatadogAppInputsSchema = AnyVersionedContract & Readonly<{
26
26
  export type PublishedDatadogAppInputsDefinition<TSchema extends AnyDatadogAppInputsSchema> = TSchema & Readonly<{
27
27
  [publishedDefinitionBrand]: (fields: TSchema['latest']['fields']) => TSchema['latest']['fields'];
28
28
  }>;
29
+ /** A package-owned definition whose concrete, deliberately invariant fields are unknown. */
30
+ export type AnyPublishedDatadogAppInputsDefinition = AnyDatadogAppInputsSchema & Readonly<{
31
+ [publishedDefinitionBrand]: unknown;
32
+ }>;
29
33
  type PortableSchema<TSchema extends AnySchema> = ValueSchema<InferOf<TSchema>>;
30
34
  interface PortableValueBuilder {
31
35
  readOnly<TSchema extends AnySchema>(schema: ValidationOnlySchema<TSchema>): ValueField<PortableSchema<TSchema>>;
@@ -103,7 +107,7 @@ export declare function datadogAppInputsDefinition<TLatest extends AnyContract,
103
107
  olderVersions?: TOlderVersions;
104
108
  }>): PublishedDatadogAppInputsDefinition<DatadogAppInputsSchema<TLatest, TSurfaces, TOlderVersions>>;
105
109
  /** Rejects copied or user-authored definitions at the public React boundary. */
106
- export declare function assertPublishedDatadogAppInputsDefinition(definition: unknown): asserts definition is PublishedDatadogAppInputsDefinition<AnyDatadogAppInputsSchema>;
110
+ export declare function assertPublishedDatadogAppInputsDefinition(definition: unknown): asserts definition is AnyPublishedDatadogAppInputsDefinition;
107
111
  /**
108
112
  * Reports whether a value is a definition created by `datadogAppInputsDefinition()`
109
113
  * (i.e. published through `@datadog/apps-frontend/inputs/schema`). Backed by the
@@ -3,5 +3,5 @@
3
3
  * Copyright 2019-Present Datadog, Inc.
4
4
  */
5
5
 
6
- import{d as i}from"../../_chunks/chunk-2V2HASKF.js";import{c as n}from"../../_chunks/chunk-T34NWJ7R.js";import"../../_chunks/chunk-X34MSTJH.js";import{useSyncExternalStore as p}from"react";function a(e){let o=i();n(e);let t=o.getClaim(e.latest);return p(t.subscribe,t.getSnapshot,t.getSnapshot)}export{a as useDatadogAppInput};
6
+ import{a}from"../../_chunks/chunk-627KNBXP.js";import"../../_chunks/chunk-2V2HASKF.js";import"../../_chunks/chunk-G2SXTUX4.js";import"../../_chunks/chunk-LEEYMNMO.js";export{a as useDatadogAppInput};
7
7
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../src/inputs/react/use-datadog-app-input.ts"],
4
- "sourcesContent": ["import { useSyncExternalStore } from 'react';\n\nimport { useAppEmbedding } from '../../embedding/react/context';\nimport type { ClaimState } from '../../embedding/types';\nimport { assertPublishedDatadogAppInputsDefinition } from '../published-definition';\nimport type { DatadogAppInputDefinition } from '../schemas/index';\n\n/**\n * What {@link useDatadogAppInput} gives back for one input: `pending` while the\n * connection or claim is in flight, `ready` with validated `fields`, `unavailable`\n * when this host does not provide the input, or `failed` with an actionable\n * `error`. `fields` exists only on `ready`, so stale values can never be read as\n * live.\n *\n * Named in terms of the input rather than the contract behind it -- which\n * version is being served is not a caller's concern.\n */\nexport type DatadogAppInputState<\n TDefinition extends DatadogAppInputDefinition,\n> = ClaimState<TDefinition['latest']>;\n\n/**\n * A type that refuses to match while saying why.\n *\n * A compiler error is the one piece of documentation a caller cannot skip, so\n * rejections here resolve to a sentence rather than to a bare `never` -- the\n * message becomes the error text, at the call site, in the editor.\n */\ntype Rejected<TMessage extends string> = Readonly<{\n __datadogAppInputsError: TMessage;\n}>;\n\ntype PublishedDefinitionFor<TDefinition extends DatadogAppInputDefinition> =\n Extract<\n DatadogAppInputDefinition,\n Readonly<{ identifier: TDefinition['identifier'] }>\n >;\n\ntype NoExtraFields<TDefinition extends DatadogAppInputDefinition> =\n Exclude<\n keyof TDefinition['latest']['fields'],\n keyof PublishedDefinitionFor<TDefinition>['latest']['fields']\n > extends never\n ? unknown\n : Rejected<'This definition has fields the published one does not. Pass a definition exported from @datadog/apps-frontend/inputs/schema, unmodified.'>;\n\n/**\n * Claims one Datadog App input and tracks its state across renders. Call it\n * below {@link DatadogAppProvider}.\n *\n * Pass a definition exported from `@datadog/apps-frontend/inputs/schema` --\n * {@link datadogTheme} is one. Hovering a definition shows the surfaces it is\n * offered on; the returned {@link ClaimState} says whether its values are usable\n * yet, and carries `fields` only while they are.\n *\n * Versions are not a caller's concern: this claims whichever version the\n * installed copy of the package treats as latest. An older copy asks for an\n * older version and keeps working for as long as the host still converts to it.\n * Past that the claim fails with `APP_MAJOR_TOO_OLD` -- update this package and\n * re-upload the app -- rather than silently degrading.\n *\n * @param definition An input definition from `@datadog/apps-frontend/inputs/schema`.\n * @returns The claim's current state: `pending`, `ready` (with `fields`),\n * `unavailable` when this host does not provide the input, or `failed` with an\n * actionable `error`.\n */\nexport function useDatadogAppInput<\n const TDefinition extends DatadogAppInputDefinition,\n>(\n definition: TDefinition & NoExtraFields<TDefinition>,\n): DatadogAppInputState<TDefinition> {\n const embedding = useAppEmbedding();\n assertPublishedDatadogAppInputsDefinition(definition);\n const store = embedding.getClaim<TDefinition['latest']>(definition.latest);\n return useSyncExternalStore(\n store.subscribe,\n store.getSnapshot,\n store.getSnapshot,\n );\n}\n"],
5
- "mappings": "gJAAA,OAAS,wBAAAA,MAA4B,QAkE9B,SAASC,EAGZC,EACiC,CACjC,IAAMC,EAAYC,EAAgB,EAClCC,EAA0CH,CAAU,EACpD,IAAMI,EAAQH,EAAU,SAAgCD,EAAW,MAAM,EACzE,OAAOK,EACHD,EAAM,UACNA,EAAM,YACNA,EAAM,WACV,CACJ",
6
- "names": ["useSyncExternalStore", "useDatadogAppInput", "definition", "embedding", "useAppEmbedding", "assertPublishedDatadogAppInputsDefinition", "store", "useSyncExternalStore"]
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
7
  }
@@ -3,5 +3,5 @@
3
3
  * Copyright 2019-Present Datadog, Inc.
4
4
  */
5
5
 
6
- import{a as O,b as T}from"../../_chunks/chunk-T34NWJ7R.js";import"../../_chunks/chunk-X34MSTJH.js";var Me=Object.freeze({status:"aborted"});function g(e,t,r){function n(u,m){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:m,constr:o,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,m);let p=o.prototype,f=Object.keys(p);for(let v=0;v<f.length;v++){let $=f[v];$ in u||(u[$]=p[$].bind(u))}}let i=r?.Parent??Object;class d extends i{}Object.defineProperty(d,"name",{value:e});function o(u){var m;let p=r?.Parent?new d:this;n(p,u),(m=p._zod).deferred??(m.deferred=[]);for(let f of p._zod.deferred)f();return p}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:u=>r?.Parent&&u instanceof r.Parent?!0:u?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var _=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};var K={};function b(e){return e&&Object.assign(K,e),K}function B(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function ie(e,t){return typeof t=="bigint"?t.toString():t}function X(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function oe(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var ne=Symbol("evaluating");function z(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ne)return n===void 0&&(n=ne,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var q="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ae(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Le=X(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});var ue=new Set(["string","number","symbol"]);function E(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function A(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function y(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ce(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Re={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function j(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function M(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function N(e){return typeof e=="string"?e:e?.message}function I(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=N(e.inst?._zod.def?.error?.(e))??N(t?.error?.(e))??N(r.customError?.(e))??N(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}var le=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ie,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},se=g("$ZodError",le),U=g("$ZodError",le,{Parent:Error});var Fe=e=>(t,r,n,i)=>{let d=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},d);if(o instanceof Promise)throw new _;if(o.issues.length){let u=new(i?.Err??e)(o.issues.map(m=>I(m,d,b())));throw q(u,i?.callee),u}return o.value},L=Fe(U),Ve=e=>async(t,r,n,i)=>{let d=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},d);if(o instanceof Promise&&(o=await o),o.issues.length){let u=new(i?.Err??e)(o.issues.map(m=>I(m,d,b())));throw q(u,i?.callee),u}return o.value},R=Ve(U),Je=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},d=t._zod.run({value:r,issues:[]},i);if(d instanceof Promise)throw new _;return d.issues.length?{success:!1,error:new(e??se)(d.issues.map(o=>I(o,i,b())))}:{success:!0,data:d.value}},Z=Je(U),Ge=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},d=t._zod.run({value:r,issues:[]},i);return d instanceof Promise&&(d=await d),d.issues.length?{success:!1,error:new e(d.issues.map(o=>I(o,i,b())))}:{success:!0,data:d.value}},P=Ge(U);var Ke="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",We=new RegExp(`^${Ke}$`);var de=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var me=/^-?\d+(?:\.\d+)?$/,pe=/^(?:true|false)$/i;var ge={major:4,minor:3,patch:6};var h=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ge;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let d of i._zod.onattach)d(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(o,u,m)=>{let p=j(o),f;for(let v of u){if(v._zod.def.when){if(!v._zod.def.when(o))continue}else if(p)continue;let $=o.issues.length,x=v._zod.check(o);if(x instanceof Promise&&m?.async===!1)throw new _;if(f||x instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await x,o.issues.length!==$&&(p||(p=j(o,$)))});else{if(o.issues.length===$)continue;p||(p=j(o,$))}}return f?f.then(()=>o):o},d=(o,u,m)=>{if(j(o))return o.aborted=!0,o;let p=i(u,n,m);if(p instanceof Promise){if(m.async===!1)throw new _;return p.then(f=>e._zod.parse(f,m))}return e._zod.parse(p,m)};e._zod.run=(o,u)=>{if(u.skipChecks)return e._zod.parse(o,u);if(u.direction==="backward"){let p=e._zod.parse({value:o.value,issues:[]},{...u,skipChecks:!0});return p instanceof Promise?p.then(f=>d(f,o,u)):d(p,o,u)}let m=e._zod.parse(o,u);if(m instanceof Promise){if(u.async===!1)throw new _;return m.then(p=>i(p,n,u))}return i(m,n,u)}}z(e,"~standard",()=>({validate:i=>{try{let d=Z(e,i);return d.success?{value:d.data}:{issues:d.error?.issues}}catch{return P(e,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),Y=g("$ZodString",(e,t)=>{h.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??de(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}});var _e=g("$ZodNumber",(e,t)=>{h.init(e,t),e._zod.pattern=e._zod.bag.pattern??me,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let d=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...d?{received:d}:{}}),r}});var H=g("$ZodBoolean",(e,t)=>{h.init(e,t),e._zod.pattern=pe,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}});function ve(e,t,r){e.issues.length&&t.issues.push(...M(r,e.issues)),t.value[r]=e.value}var xe=g("$ZodArray",(e,t)=>{h.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let d=[];for(let o=0;o<i.length;o++){let u=i[o],m=t.element._zod.run({value:u,issues:[]},n);m instanceof Promise?d.push(m.then(p=>ve(p,r,o))):ve(m,r,o)}return d.length?Promise.all(d).then(()=>r):r}});function C(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...M(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Xe(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=ce(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function qe(e,t,r,n,i,d){let o=[],u=i.keySet,m=i.catchall._zod,p=m.def.type,f=m.optout==="optional";for(let v in t){if(u.has(v))continue;if(p==="never"){o.push(v);continue}let $=m.run({value:t[v],issues:[]},n);$ instanceof Promise?e.push($.then(x=>C(x,r,v,t,f))):C($,r,v,t,f)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:d}),e.length?Promise.all(e).then(()=>r):r}var ye=g("$ZodObject",(e,t)=>{if(h.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let u=t.shape;Object.defineProperty(t,"shape",{get:()=>{let m={...u};return Object.defineProperty(t,"shape",{value:m}),m}})}let n=X(()=>Xe(t));z(e._zod,"propValues",()=>{let u=t.shape,m={};for(let p in u){let f=u[p]._zod;if(f.values){m[p]??(m[p]=new Set);for(let v of f.values)m[p].add(v)}}return m});let i=ae,d=t.catchall,o;e._zod.parse=(u,m)=>{o??(o=n.value);let p=u.value;if(!i(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value={};let f=[],v=o.shape;for(let $ of o.keys){let x=v[$],w=x._zod.optout==="optional",G=x._zod.run({value:p[$],issues:[]},m);G instanceof Promise?f.push(G.then(Ae=>C(Ae,u,$,p,w))):C(G,u,$,p,w)}return d?qe(f,p,u,m,n.value,e):f.length?Promise.all(f).then(()=>u):u}});var be=g("$ZodEnum",(e,t)=>{h.init(e,t);let r=B(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>ue.has(typeof i)).map(i=>typeof i=="string"?E(i):i.toString()).join("|")})$`),e._zod.parse=(i,d)=>{let o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:r,input:o,inst:e}),i}});function $e(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var ze=g("$ZodOptional",(e,t)=>{h.init(e,t),e._zod.optin="optional",e._zod.optout="optional",z(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),z(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${oe(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(d=>$e(d,r.value)):$e(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var Ie;var Q=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Se(){return new Q}(Ie=globalThis).__zod_globalRegistry??(Ie.__zod_globalRegistry=Se());var ee=globalThis.__zod_globalRegistry;function we(e,t){return new e({type:"string",...y(t)})}function je(e,t){return new e({type:"number",checks:[],...y(t)})}function Ue(e,t){return new e({type:"boolean",...y(t)})}var k=g("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");h.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>L(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Z(e,r,n),e.parseAsync=async(r,n)=>R(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>P(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>A(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Ze=g("ZodMiniString",(e,t)=>{Y.init(e,t),k.init(e,t)});function S(e){return we(Ze,e)}var Pe=g("ZodMiniNumber",(e,t)=>{_e.init(e,t),k.init(e,t)});function te(e){return je(Pe,e)}var De=g("ZodMiniBoolean",(e,t)=>{H.init(e,t),k.init(e,t)});function Oe(e){return Ue(De,e)}var lt=g("ZodMiniArray",(e,t)=>{xe.init(e,t),k.init(e,t)});function re(e,t){return new lt({type:"array",element:e,...y(t)})}var st=g("ZodMiniObject",(e,t)=>{ye.init(e,t),k.init(e,t),z(e,"shape",()=>t.shape)});function V(e,t){let r={type:"object",shape:e??{},...y(t)};return new st(r)}var dt=g("ZodMiniEnum",(e,t)=>{be.init(e,t),k.init(e,t),e.options=Object.values(t.entries)});function Te(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new dt({type:"enum",entries:r,...y(t)})}var mt=g("ZodMiniOptional",(e,t)=>{ze.init(e,t),k.init(e,t)});function J(e){return new mt({type:"optional",innerType:e})}var ht=T({identifier:"datadog.theme",version:1,fields:{theme:O.readOnly(Te(["light","dark"]))}});var _t=V({name:S(),value:S(),values:J(re(S())),prefix:J(S()),default:J(S())}),xt=V({start:te(),end:te(),isLive:Oe()}),yt=V({timeframe:xt,templateVariables:re(_t)}),bt=T({identifier:"datadog.dashboard",version:1,surfaces:["datadog.dashboard"],fields:{dashboard:O.readOnly(yt)}});export{bt as datadogDashboard,ht as datadogTheme};
6
+ import{a,b}from"../../_chunks/chunk-QOXXZE7D.js";import"../../_chunks/chunk-PA4Z7DNH.js";import"../../_chunks/chunk-G2SXTUX4.js";import"../../_chunks/chunk-LEEYMNMO.js";export{b as datadogDashboard,a as datadogTheme};
7
7
  //# sourceMappingURL=index.js.map