@datadog/apps-frontend 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/_chunks/chunk-64RLSXHA.js +184 -0
- package/dist/src/_chunks/chunk-64RLSXHA.js.map +7 -0
- package/dist/src/_chunks/chunk-BWBMAWDD.js +235 -0
- package/dist/src/_chunks/{chunk-OEPH347K.js.map → chunk-BWBMAWDD.js.map} +3 -3
- package/dist/src/_chunks/chunk-E6L6DSL7.js +230 -0
- package/dist/src/_chunks/{chunk-LEEYMNMO.js.map → chunk-E6L6DSL7.js.map} +1 -1
- package/dist/src/_chunks/chunk-OF23NNWB.js +34 -0
- package/dist/src/_chunks/{chunk-XSHCFEOH.js.map → chunk-OF23NNWB.js.map} +1 -1
- package/dist/src/_chunks/chunk-ONCDAC2F.js +802 -0
- package/dist/src/_chunks/{chunk-EYBITW7J.js.map → chunk-ONCDAC2F.js.map} +2 -2
- package/dist/src/_chunks/chunk-SSORLL57.js +219 -0
- package/dist/src/_chunks/{chunk-D43RPVCF.js.map → chunk-SSORLL57.js.map} +1 -1
- package/dist/src/_chunks/chunk-VSZMABRM.js +54 -0
- package/dist/src/_chunks/{chunk-2V2HASKF.js.map → chunk-VSZMABRM.js.map} +1 -1
- package/dist/src/deep-links/react/index.js +8 -1
- package/dist/src/druids/react/index.js +25 -1
- package/dist/src/druids/react/index.js.map +1 -1
- package/dist/src/embedding/react/index.js +2908 -1
- package/dist/src/embedding/react/index.js.map +1 -1
- package/dist/src/inputs/published-definition.d.ts +13 -0
- package/dist/src/inputs/react/index.js +9 -1
- package/dist/src/inputs/schemas/index.js +15 -1
- package/package.json +2 -1
- package/dist/src/_chunks/chunk-2V2HASKF.js +0 -7
- package/dist/src/_chunks/chunk-D43RPVCF.js +0 -7
- package/dist/src/_chunks/chunk-DETZPDFA.js +0 -7
- package/dist/src/_chunks/chunk-DETZPDFA.js.map +0 -7
- package/dist/src/_chunks/chunk-EYBITW7J.js +0 -7
- package/dist/src/_chunks/chunk-LEEYMNMO.js +0 -7
- package/dist/src/_chunks/chunk-OEPH347K.js +0 -7
- package/dist/src/_chunks/chunk-XSHCFEOH.js +0 -7
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
|
|
2
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
3
|
+
* Copyright 2019-Present Datadog, Inc.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
a as g,
|
|
8
|
+
b as t,
|
|
9
|
+
c,
|
|
10
|
+
d as y,
|
|
11
|
+
e as b,
|
|
12
|
+
f as u,
|
|
13
|
+
g as r,
|
|
14
|
+
i as I,
|
|
15
|
+
j as n
|
|
16
|
+
} from "./chunk-ONCDAC2F.js";
|
|
17
|
+
import {
|
|
18
|
+
a as i,
|
|
19
|
+
b as P,
|
|
20
|
+
c as A,
|
|
21
|
+
d as S,
|
|
22
|
+
e as d,
|
|
23
|
+
f as s
|
|
24
|
+
} from "./chunk-BWBMAWDD.js";
|
|
25
|
+
|
|
26
|
+
// src/inputs/schemas/tooling/define-input-schema.ts
|
|
27
|
+
function V(a) {
|
|
28
|
+
if (a !== "public" && a !== "internal")
|
|
29
|
+
throw new Error(
|
|
30
|
+
"Every input schema version must explicitly declare a public or internal audience."
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function w(a) {
|
|
34
|
+
return (e) => (V(e.audience), Object.freeze({
|
|
35
|
+
contract: A({
|
|
36
|
+
identifier: a,
|
|
37
|
+
version: e.version,
|
|
38
|
+
fields: e.fields
|
|
39
|
+
}),
|
|
40
|
+
audience: e.audience
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
function p(a) {
|
|
44
|
+
let e = a, m = w(e.identifier), { latest: l, olderVersions: f = [] } = e.versions ? e.versions(m) : {
|
|
45
|
+
latest: m(
|
|
46
|
+
a
|
|
47
|
+
)
|
|
48
|
+
};
|
|
49
|
+
if (l.contract.identifier !== e.identifier)
|
|
50
|
+
throw new Error(
|
|
51
|
+
"Input schema versions must use the schema\u2019s declared identifier."
|
|
52
|
+
);
|
|
53
|
+
if (f.some((o) => o.currentContract !== l.contract))
|
|
54
|
+
throw new Error(
|
|
55
|
+
"Every retained input schema converter must be built from the schema\u2019s latest contract."
|
|
56
|
+
);
|
|
57
|
+
let z = S({
|
|
58
|
+
latest: l.contract,
|
|
59
|
+
surfaces: e.surfaces,
|
|
60
|
+
olderVersions: f.map((o) => o.definition)
|
|
61
|
+
}), O = [
|
|
62
|
+
{ version: l.contract.version, audience: l.audience },
|
|
63
|
+
...f.map((o) => ({
|
|
64
|
+
version: o.definition.contract.version,
|
|
65
|
+
audience: o.audience
|
|
66
|
+
}))
|
|
67
|
+
].map((o) => (V(o.audience), Object.freeze(o)));
|
|
68
|
+
return Object.freeze({
|
|
69
|
+
name: e.name,
|
|
70
|
+
definition: z,
|
|
71
|
+
publications: Object.freeze(O)
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/inputs/schemas/theme.ts
|
|
76
|
+
function v() {
|
|
77
|
+
return p({
|
|
78
|
+
name: "datadogTheme",
|
|
79
|
+
identifier: "datadog.theme",
|
|
80
|
+
version: 1,
|
|
81
|
+
audience: "public",
|
|
82
|
+
fields: { theme: i.readOnly(I(["light", "dark"])) }
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/inputs/schemas/generated/hosts/theme.ts
|
|
87
|
+
var E = /* @__PURE__ */ v(), D = E.definition;
|
|
88
|
+
|
|
89
|
+
// src/inputs/schemas/generated/consumers/theme.ts
|
|
90
|
+
var j = /* @__PURE__ */ s(/* @__PURE__ */ d(D), "dd-app-input/v1 datadog.theme surfaces=");
|
|
91
|
+
|
|
92
|
+
// src/inputs/schemas/dashboard.ts
|
|
93
|
+
function x() {
|
|
94
|
+
let a = r({
|
|
95
|
+
name: t(),
|
|
96
|
+
value: t(),
|
|
97
|
+
values: n(u(t())),
|
|
98
|
+
prefix: n(t()),
|
|
99
|
+
default: n(t())
|
|
100
|
+
}), e = r({
|
|
101
|
+
start: c(),
|
|
102
|
+
end: c(),
|
|
103
|
+
isLive: y()
|
|
104
|
+
}), m = r({
|
|
105
|
+
timeframe: e,
|
|
106
|
+
templateVariables: u(a)
|
|
107
|
+
});
|
|
108
|
+
return p({
|
|
109
|
+
name: "datadogDashboard",
|
|
110
|
+
identifier: "datadog.dashboard",
|
|
111
|
+
version: 1,
|
|
112
|
+
audience: "public",
|
|
113
|
+
surfaces: ["datadog.dashboard"],
|
|
114
|
+
fields: { dashboard: i.readOnly(m) }
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/inputs/schemas/generated/hosts/dashboard.ts
|
|
119
|
+
var H = /* @__PURE__ */ x(), T = H.definition;
|
|
120
|
+
|
|
121
|
+
// src/inputs/schemas/generated/consumers/dashboard.ts
|
|
122
|
+
var L = /* @__PURE__ */ s(/* @__PURE__ */ d(T), "dd-app-input/v1 datadog.dashboard surfaces=datadog.dashboard");
|
|
123
|
+
|
|
124
|
+
// src/inputs/schemas/notebook.ts
|
|
125
|
+
function C() {
|
|
126
|
+
let a = r({
|
|
127
|
+
name: t(),
|
|
128
|
+
value: t(),
|
|
129
|
+
values: n(u(t())),
|
|
130
|
+
prefix: n(t()),
|
|
131
|
+
default: n(t()),
|
|
132
|
+
availableValues: n(u(t()))
|
|
133
|
+
}), e = r({
|
|
134
|
+
timeframe: r({
|
|
135
|
+
start: c(),
|
|
136
|
+
end: c(),
|
|
137
|
+
isLive: y()
|
|
138
|
+
}),
|
|
139
|
+
templateVariables: u(a)
|
|
140
|
+
});
|
|
141
|
+
return p({
|
|
142
|
+
name: "datadogNotebook",
|
|
143
|
+
identifier: "datadog.notebook",
|
|
144
|
+
version: 1,
|
|
145
|
+
audience: "public",
|
|
146
|
+
surfaces: ["datadog.notebook"],
|
|
147
|
+
fields: { notebook: i.readOnly(e) }
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// src/inputs/schemas/generated/hosts/notebook.ts
|
|
152
|
+
var N = /* @__PURE__ */ C(), F = N.definition;
|
|
153
|
+
|
|
154
|
+
// src/inputs/schemas/generated/consumers/notebook.ts
|
|
155
|
+
var B = /* @__PURE__ */ s(/* @__PURE__ */ d(F), "dd-app-input/v1 datadog.notebook surfaces=datadog.notebook");
|
|
156
|
+
|
|
157
|
+
// src/inputs/schemas/service-panel.ts
|
|
158
|
+
function k() {
|
|
159
|
+
return p({
|
|
160
|
+
name: "datadogServicePanel",
|
|
161
|
+
identifier: "datadog.idp.service-panel",
|
|
162
|
+
version: 1,
|
|
163
|
+
audience: "public",
|
|
164
|
+
surfaces: ["datadog.idp.service-panel"],
|
|
165
|
+
fields: {
|
|
166
|
+
service: i.readOnly(t().check(g(1))),
|
|
167
|
+
close: P.readOnly({ inputs: {}, result: b() })
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// src/inputs/schemas/generated/hosts/service-panel.ts
|
|
173
|
+
var M = /* @__PURE__ */ k(), R = M.definition;
|
|
174
|
+
|
|
175
|
+
// src/inputs/schemas/generated/consumers/service-panel.ts
|
|
176
|
+
var U = /* @__PURE__ */ s(/* @__PURE__ */ d(R), "dd-app-input/v1 datadog.idp.service-panel surfaces=datadog.idp.service-panel");
|
|
177
|
+
|
|
178
|
+
export {
|
|
179
|
+
j as a,
|
|
180
|
+
L as b,
|
|
181
|
+
B as c,
|
|
182
|
+
U as d
|
|
183
|
+
};
|
|
184
|
+
//# sourceMappingURL=chunk-64RLSXHA.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/inputs/schemas/tooling/define-input-schema.ts", "../../../src/inputs/schemas/theme.ts", "../../../src/inputs/schemas/generated/hosts/theme.ts", "../../../src/inputs/schemas/generated/consumers/theme.ts", "../../../src/inputs/schemas/dashboard.ts", "../../../src/inputs/schemas/generated/hosts/dashboard.ts", "../../../src/inputs/schemas/generated/consumers/dashboard.ts", "../../../src/inputs/schemas/notebook.ts", "../../../src/inputs/schemas/generated/hosts/notebook.ts", "../../../src/inputs/schemas/generated/consumers/notebook.ts", "../../../src/inputs/schemas/service-panel.ts", "../../../src/inputs/schemas/generated/hosts/service-panel.ts", "../../../src/inputs/schemas/generated/consumers/service-panel.ts"],
|
|
4
|
+
"sourcesContent": ["import type {\n AnyField,\n ContractVersion,\n EVERY_SURFACE,\n SurfaceId,\n} from '../../../embedding/types';\nimport type { OlderContractVersion } from '../../../embedding/versioning';\nimport {\n datadogAppInputsDefinition,\n datadogAppInputsVersion,\n} from '../../published-definition';\nimport type {\n DatadogAppInputsSchema,\n PortableContract,\n PublishedDatadogAppInputsDefinition,\n} from '../../published-definition';\nimport { retainedInputsVersion } from '../../retained-version';\nimport type { RetainedDatadogAppInputsVersion } from '../../types';\nimport type {\n AnyAuthoredInputSchema,\n AnyAuthoredInputSchemaVersion,\n AnyRetainedInputSchemaVersion,\n AuthoredInputSchema,\n InputSchemaAudience,\n InputSchemaPublications,\n InputSchemaVersionBuilder,\n InputSchemaVersionDeclaration,\n RetainedInputSchemaDefinitions,\n RetainedInputSchemaVersion,\n} from '../types';\n\nfunction assertAudience(\n audience: unknown,\n): asserts audience is InputSchemaAudience {\n if (audience !== 'public' && audience !== 'internal') {\n throw new Error(\n 'Every input schema version must explicitly declare a public or internal audience.',\n );\n }\n}\n\nfunction versionBuilder<TIdentifier extends string>(\n identifier: TIdentifier,\n): InputSchemaVersionBuilder<TIdentifier> {\n return (declaration) => {\n assertAudience(declaration.audience);\n return Object.freeze({\n contract: datadogAppInputsVersion({\n identifier,\n version: declaration.version,\n fields: declaration.fields,\n }),\n audience: declaration.audience,\n });\n };\n}\n\n/**\n * Declare one named schema, with its identity and surfaces specified just once.\n * Factories return an inferred local with an AnyAuthoredInputSchema annotation:\n * isolated declarations stay small while the inspector sees every field type.\n *\n * Audience controls SDK exposure only. Every declared retained version is still\n * served by the existing inputs/versioning runtime, public or internal.\n */\nexport function defineInputSchema<\n const TName extends string,\n const TIdentifier extends string,\n const TVersion extends ContractVersion,\n const TAudience extends InputSchemaAudience,\n const TFields extends Record<string, AnyField>,\n const TSurfaces extends readonly SurfaceId[] = typeof EVERY_SURFACE,\n>(\n declaration: InputSchemaVersionDeclaration<TVersion, TAudience, TFields> &\n Readonly<{\n name: TName;\n identifier: TIdentifier;\n surfaces?: TSurfaces;\n }>,\n): AuthoredInputSchema<\n TName,\n PublishedDatadogAppInputsDefinition<\n DatadogAppInputsSchema<\n PortableContract<TIdentifier, TVersion, TFields>,\n TSurfaces\n >\n >,\n readonly [Readonly<{ version: TVersion; audience: TAudience }>]\n>;\nexport function defineInputSchema<\n const TName extends string,\n const TIdentifier extends string,\n TLatest extends AnyAuthoredInputSchemaVersion,\n const TOlderVersions extends readonly AnyRetainedInputSchemaVersion<\n TLatest['contract']\n >[] = readonly [],\n const TSurfaces extends readonly SurfaceId[] = typeof EVERY_SURFACE,\n>(\n declaration: Readonly<{\n name: TName;\n identifier: TIdentifier;\n surfaces?: TSurfaces;\n versions: (\n version: InputSchemaVersionBuilder<TIdentifier>,\n ) => Readonly<{\n latest: TLatest;\n olderVersions?: TOlderVersions;\n }>;\n }>,\n): AuthoredInputSchema<\n TName,\n PublishedDatadogAppInputsDefinition<\n DatadogAppInputsSchema<\n TLatest['contract'],\n TSurfaces,\n RetainedInputSchemaDefinitions<TLatest['contract'], TOlderVersions>\n >\n >,\n InputSchemaPublications<TLatest, TOlderVersions>\n>;\nexport function defineInputSchema(\n declarationInput: object,\n): AnyAuthoredInputSchema {\n const declaration = declarationInput as Readonly<{\n name: string;\n identifier: string;\n surfaces?: readonly SurfaceId[];\n versions?: (version: InputSchemaVersionBuilder<string>) => Readonly<{\n latest: AnyAuthoredInputSchemaVersion;\n olderVersions?: readonly AnyRetainedInputSchemaVersion<\n AnyAuthoredInputSchemaVersion['contract']\n >[];\n }>;\n }>;\n const version = versionBuilder(declaration.identifier);\n const { latest, olderVersions = [] } = declaration.versions\n ? declaration.versions(version)\n : {\n latest: version(\n declarationInput as Parameters<typeof version>[0],\n ),\n };\n if (latest.contract.identifier !== declaration.identifier) {\n throw new Error(\n 'Input schema versions must use the schema\u2019s declared identifier.',\n );\n }\n if (\n olderVersions.some((older) => older.currentContract !== latest.contract)\n ) {\n throw new Error(\n 'Every retained input schema converter must be built from the schema\u2019s latest contract.',\n );\n }\n const definition = datadogAppInputsDefinition({\n latest: latest.contract,\n surfaces: declaration.surfaces,\n olderVersions: olderVersions.map((older) => older.definition),\n });\n const publications = [\n { version: latest.contract.version, audience: latest.audience },\n ...olderVersions.map((older) => ({\n version: older.definition.contract.version,\n audience: older.audience,\n })),\n ].map((publication) => {\n assertAudience(publication.audience);\n return Object.freeze(publication);\n });\n return Object.freeze({\n name: declaration.name,\n definition,\n publications: Object.freeze(publications),\n });\n}\n\n/** Keep the existing typed, plain-value retained converter; unwrap metadata only. */\nexport function retainInputSchemaVersion<\n TCurrent extends AnyAuthoredInputSchemaVersion,\n TRetained extends AnyAuthoredInputSchemaVersion,\n const TExtras extends Record<string, AnyField>,\n>(\n current: TCurrent,\n declaration: Omit<\n RetainedDatadogAppInputsVersion<\n TCurrent['contract'],\n TRetained['contract'],\n TExtras\n >,\n 'contract'\n > &\n Readonly<{ contract: TRetained }>,\n): RetainedInputSchemaVersion<\n OlderContractVersion<TCurrent['contract'], TRetained['contract'], TExtras>,\n TRetained['audience']\n> {\n assertAudience(declaration.contract.audience);\n return Object.freeze({\n currentContract: current.contract,\n definition: retainedInputsVersion(current.contract, {\n ...declaration,\n contract: declaration.contract.contract,\n }),\n audience: declaration.contract.audience,\n });\n}\n", "import * as z from 'zod/mini';\n\nimport { value } from '../published-definition';\n\nimport { defineInputSchema } from './tooling/define-input-schema';\nimport type { AnyAuthoredInputSchema } from './types';\n\n/** Datadog's current resolved theme, offered on every surface. */\nexport function createThemeInputs(): AnyAuthoredInputSchema {\n const schema = defineInputSchema({\n name: 'datadogTheme',\n identifier: 'datadog.theme',\n version: 1,\n audience: 'public',\n fields: { theme: value.readOnly(z.enum(['light', 'dark'])) },\n });\n return schema;\n}\n", "// Generated by src/inputs/schemas/tooling/generate.cjs. Edit the schema/registry, then run yarn generate:inputs.\nimport type { ValueSchema, ValueField, FunctionField } from '../../../../embedding/types';\nimport type { OlderContractVersion } from '../../../../embedding/versioning';\nimport type { PortableContract, PublishedDatadogAppInputsDefinition, DatadogAppInputsSchema } from '../../../published-definition';\nimport { createThemeInputs as createSchema } from '../../theme';\ntype Payload0 = \"light\" | \"dark\";\ntype Current = PortableContract<\"datadog.theme\", 1, { \"theme\": ValueField<ValueSchema<Payload0>>; }>;\ntype Definition = PublishedDatadogAppInputsDefinition<DatadogAppInputsSchema<Current, readonly [\"datadog.idp.homepage\",\"datadog.idp.service-panel\",\"datadog.idp.self-service\",\"datadog.app-builder\",\"datadog.appsec\",\"datadog.notebook\",\"datadog.dashboard\"], readonly []>>;\nconst schema = /* @__PURE__ */ createSchema();\nexport const datadogTheme: Definition = schema.definition as Definition;\n", "// Generated by src/inputs/schemas/tooling/generate.cjs. Edit the schema/registry, then run yarn generate:inputs.\nimport { datadogTheme as hostDefinition } from '../hosts/theme';\nimport type { ValueSchema, ValueField, FunctionField } from '../../../../embedding/types';\nimport { createDatadogAppInputConsumer, withInputBuildMarker } from '../../../published-definition';\nimport type { PortableContract, PublishedDatadogAppInput } from '../../../published-definition';\nimport type { DatadogAppInputsHostValues } from '../../../types';\ntype Payload0 = \"light\" | \"dark\";\ntype Current = PortableContract<\"datadog.theme\", 1, { \"theme\": ValueField<ValueSchema<Payload0>>; }>;\nexport const datadogTheme: PublishedDatadogAppInput<Current, readonly [\"datadog.idp.homepage\",\"datadog.idp.service-panel\",\"datadog.idp.self-service\",\"datadog.app-builder\",\"datadog.appsec\",\"datadog.notebook\",\"datadog.dashboard\"]> = /* @__PURE__ */ withInputBuildMarker(/* @__PURE__ */ createDatadogAppInputConsumer(hostDefinition), \"dd-app-input/v1 datadog.theme surfaces=\");\nexport type DatadogAppTheme = DatadogAppInputsHostValues<typeof datadogTheme>['theme'];\n", "import * as z from 'zod/mini';\n\nimport { value } from '../published-definition';\n\nimport { defineInputSchema } from './tooling/define-input-schema';\nimport type { AnyAuthoredInputSchema } from './types';\n\n/** One dashboard field, matching the payload existing dashboard hosts supply. */\nexport function createDashboardInputs(): AnyAuthoredInputSchema {\n const templateVariableSchema = z.object({\n name: z.string(),\n value: z.string(),\n values: z.optional(z.array(z.string())),\n prefix: z.optional(z.string()),\n default: z.optional(z.string()),\n });\n const timeframeSchema = z.object({\n start: z.number(),\n end: z.number(),\n isLive: z.boolean(),\n });\n const dashboardStateSchema = z.object({\n timeframe: timeframeSchema,\n templateVariables: z.array(templateVariableSchema),\n });\n const schema = defineInputSchema({\n name: 'datadogDashboard',\n identifier: 'datadog.dashboard',\n version: 1,\n audience: 'public',\n surfaces: ['datadog.dashboard'],\n fields: { dashboard: value.readOnly(dashboardStateSchema) },\n });\n return schema;\n}\n", "// Generated by src/inputs/schemas/tooling/generate.cjs. Edit the schema/registry, then run yarn generate:inputs.\nimport type { ValueSchema, ValueField, FunctionField } from '../../../../embedding/types';\nimport type { OlderContractVersion } from '../../../../embedding/versioning';\nimport type { PortableContract, PublishedDatadogAppInputsDefinition, DatadogAppInputsSchema } from '../../../published-definition';\nimport type { DatadogAppInputImplementations } from '../../../types';\nimport { createDashboardInputs as createSchema } from '../../dashboard';\ntype Payload0 = { \"timeframe\": Payload1; \"templateVariables\": Payload3; };\ntype Payload1 = { \"start\": number; \"end\": number; \"isLive\": Payload2; };\ntype Payload2 = false | true;\ntype Payload3 = Array<Payload4>;\ntype Payload4 = { \"name\": string; \"value\": string; \"values\"?: Payload5; \"prefix\"?: Payload7; \"default\"?: Payload7; };\ntype Payload5 = undefined | Payload6;\ntype Payload6 = Array<string>;\ntype Payload7 = undefined | string;\ntype Current = PortableContract<\"datadog.dashboard\", 1, { \"dashboard\": ValueField<ValueSchema<Payload0>>; }>;\ntype Definition = PublishedDatadogAppInputsDefinition<DatadogAppInputsSchema<Current, readonly [\"datadog.dashboard\"], readonly []>>;\nconst schema = /* @__PURE__ */ createSchema();\nexport const datadogDashboard: Definition = schema.definition as Definition;\nexport type DashboardInputs = DatadogAppInputImplementations<typeof datadogDashboard>;\n", "// Generated by src/inputs/schemas/tooling/generate.cjs. Edit the schema/registry, then run yarn generate:inputs.\nimport { datadogDashboard as hostDefinition } from '../hosts/dashboard';\nimport type { ValueSchema, ValueField, FunctionField } from '../../../../embedding/types';\nimport { createDatadogAppInputConsumer, withInputBuildMarker } from '../../../published-definition';\nimport type { PortableContract, PublishedDatadogAppInput } from '../../../published-definition';\nimport type { DatadogAppInputsHostValues } from '../../../types';\ntype Payload0 = { \"timeframe\": Payload1; \"templateVariables\": Payload3; };\ntype Payload1 = { \"start\": number; \"end\": number; \"isLive\": Payload2; };\ntype Payload2 = false | true;\ntype Payload3 = Array<Payload4>;\ntype Payload4 = { \"name\": string; \"value\": string; \"values\"?: Payload5; \"prefix\"?: Payload7; \"default\"?: Payload7; };\ntype Payload5 = undefined | Payload6;\ntype Payload6 = Array<string>;\ntype Payload7 = undefined | string;\ntype Current = PortableContract<\"datadog.dashboard\", 1, { \"dashboard\": ValueField<ValueSchema<Payload0>>; }>;\nexport const datadogDashboard: PublishedDatadogAppInput<Current, readonly [\"datadog.dashboard\"]> = /* @__PURE__ */ withInputBuildMarker(/* @__PURE__ */ createDatadogAppInputConsumer(hostDefinition), \"dd-app-input/v1 datadog.dashboard surfaces=datadog.dashboard\");\nexport type DashboardInputs = DatadogAppInputsHostValues<typeof datadogDashboard>;\n", "import * as z from 'zod/mini';\n\nimport { value } from '../published-definition';\n\nimport { defineInputSchema } from './tooling/define-input-schema';\nimport type { AnyAuthoredInputSchema } from './types';\n\n/** Notebook timeframe and template variables supplied by an embedded notebook host. */\nexport function createNotebookInputs(): AnyAuthoredInputSchema {\n const templateVariableSchema = z.object({\n name: z.string(),\n value: z.string(),\n values: z.optional(z.array(z.string())),\n prefix: z.optional(z.string()),\n default: z.optional(z.string()),\n availableValues: z.optional(z.array(z.string())),\n });\n const notebookStateSchema = z.object({\n timeframe: z.object({\n start: z.number(),\n end: z.number(),\n isLive: z.boolean(),\n }),\n templateVariables: z.array(templateVariableSchema),\n });\n const schema = defineInputSchema({\n name: 'datadogNotebook',\n identifier: 'datadog.notebook',\n version: 1,\n audience: 'public',\n surfaces: ['datadog.notebook'],\n fields: { notebook: value.readOnly(notebookStateSchema) },\n });\n return schema;\n}\n", "// Generated by src/inputs/schemas/tooling/generate.cjs. Edit the schema/registry, then run yarn generate:inputs.\nimport type { ValueSchema, ValueField, FunctionField } from '../../../../embedding/types';\nimport type { OlderContractVersion } from '../../../../embedding/versioning';\nimport type { PortableContract, PublishedDatadogAppInputsDefinition, DatadogAppInputsSchema } from '../../../published-definition';\nimport type { DatadogAppInputImplementations } from '../../../types';\nimport { createNotebookInputs as createSchema } from '../../notebook';\ntype Payload0 = { \"timeframe\": Payload1; \"templateVariables\": Payload3; };\ntype Payload1 = { \"start\": number; \"end\": number; \"isLive\": Payload2; };\ntype Payload2 = false | true;\ntype Payload3 = Array<Payload4>;\ntype Payload4 = { \"name\": string; \"value\": string; \"values\"?: Payload5; \"prefix\"?: Payload7; \"default\"?: Payload7; \"availableValues\"?: Payload5; };\ntype Payload5 = undefined | Payload6;\ntype Payload6 = Array<string>;\ntype Payload7 = undefined | string;\ntype Current = PortableContract<\"datadog.notebook\", 1, { \"notebook\": ValueField<ValueSchema<Payload0>>; }>;\ntype Definition = PublishedDatadogAppInputsDefinition<DatadogAppInputsSchema<Current, readonly [\"datadog.notebook\"], readonly []>>;\nconst schema = /* @__PURE__ */ createSchema();\nexport const datadogNotebook: Definition = schema.definition as Definition;\nexport type NotebookInputs = DatadogAppInputImplementations<typeof datadogNotebook>;\n", "// Generated by src/inputs/schemas/tooling/generate.cjs. Edit the schema/registry, then run yarn generate:inputs.\nimport { datadogNotebook as hostDefinition } from '../hosts/notebook';\nimport type { ValueSchema, ValueField, FunctionField } from '../../../../embedding/types';\nimport { createDatadogAppInputConsumer, withInputBuildMarker } from '../../../published-definition';\nimport type { PortableContract, PublishedDatadogAppInput } from '../../../published-definition';\nimport type { DatadogAppInputsHostValues } from '../../../types';\ntype Payload0 = { \"timeframe\": Payload1; \"templateVariables\": Payload3; };\ntype Payload1 = { \"start\": number; \"end\": number; \"isLive\": Payload2; };\ntype Payload2 = false | true;\ntype Payload3 = Array<Payload4>;\ntype Payload4 = { \"name\": string; \"value\": string; \"values\"?: Payload5; \"prefix\"?: Payload7; \"default\"?: Payload7; \"availableValues\"?: Payload5; };\ntype Payload5 = undefined | Payload6;\ntype Payload6 = Array<string>;\ntype Payload7 = undefined | string;\ntype Current = PortableContract<\"datadog.notebook\", 1, { \"notebook\": ValueField<ValueSchema<Payload0>>; }>;\nexport const datadogNotebook: PublishedDatadogAppInput<Current, readonly [\"datadog.notebook\"]> = /* @__PURE__ */ withInputBuildMarker(/* @__PURE__ */ createDatadogAppInputConsumer(hostDefinition), \"dd-app-input/v1 datadog.notebook surfaces=datadog.notebook\");\nexport type NotebookInputs = DatadogAppInputsHostValues<typeof datadogNotebook>;\n", "import * as z from 'zod/mini';\n\nimport { fn, value } from '../published-definition';\n\nimport { defineInputSchema } from './tooling/define-input-schema';\nimport type { AnyAuthoredInputSchema } from './types';\n\n/** Internal Service Catalog context; the product owns what close does. */\nexport function createServicePanelInputs(): AnyAuthoredInputSchema {\n const schema = defineInputSchema({\n name: 'datadogServicePanel',\n identifier: 'datadog.idp.service-panel',\n version: 1,\n audience: 'public',\n surfaces: ['datadog.idp.service-panel'],\n fields: {\n service: value.readOnly(z.string().check(z.minLength(1))),\n close: fn.readOnly({ inputs: {}, result: z.undefined() }),\n },\n });\n return schema;\n}\n", "// Generated by src/inputs/schemas/tooling/generate.cjs. Edit the schema/registry, then run yarn generate:inputs.\nimport type { ValueSchema, ValueField, FunctionField } from '../../../../embedding/types';\nimport type { OlderContractVersion } from '../../../../embedding/versioning';\nimport type { PortableContract, PublishedDatadogAppInputsDefinition, DatadogAppInputsSchema } from '../../../published-definition';\nimport type { DatadogAppInputImplementations } from '../../../types';\nimport { createServicePanelInputs as createSchema } from '../../service-panel';\n\ntype Current = PortableContract<\"datadog.idp.service-panel\", 1, { \"service\": ValueField<ValueSchema<string>>; \"close\": FunctionField<{ }, ValueSchema<undefined>>; }>;\ntype Definition = PublishedDatadogAppInputsDefinition<DatadogAppInputsSchema<Current, readonly [\"datadog.idp.service-panel\"], readonly []>>;\nconst schema = /* @__PURE__ */ createSchema();\nexport const datadogServicePanel: Definition = schema.definition as Definition;\nexport type ServicePanelInputs = DatadogAppInputImplementations<typeof datadogServicePanel>;\n", "// Generated by src/inputs/schemas/tooling/generate.cjs. Edit the schema/registry, then run yarn generate:inputs.\nimport { datadogServicePanel as hostDefinition } from '../hosts/service-panel';\nimport type { ValueSchema, ValueField, FunctionField } from '../../../../embedding/types';\nimport { createDatadogAppInputConsumer, withInputBuildMarker } from '../../../published-definition';\nimport type { PortableContract, PublishedDatadogAppInput } from '../../../published-definition';\nimport type { DatadogAppInputsHostValues } from '../../../types';\n\ntype Current = PortableContract<\"datadog.idp.service-panel\", 1, { \"service\": ValueField<ValueSchema<string>>; \"close\": FunctionField<{ }, ValueSchema<undefined>>; }>;\nexport const datadogServicePanel: PublishedDatadogAppInput<Current, readonly [\"datadog.idp.service-panel\"]> = /* @__PURE__ */ withInputBuildMarker(/* @__PURE__ */ createDatadogAppInputConsumer(hostDefinition), \"dd-app-input/v1 datadog.idp.service-panel surfaces=datadog.idp.service-panel\");\nexport type ServicePanelInputs = DatadogAppInputsHostValues<typeof datadogServicePanel>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AA+BA,SAASA,EACLC,GACuC;AACvC,MAAIA,MAAa,YAAYA,MAAa;AACtC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AkCF,EAAO;;;ACF/C,IAAMG,IAAiH,gBAAAC,EAAqC,gBAAAC,EAA8BF,CAAc,GAAG,8EAA8E;",
|
|
6
|
+
"names": ["assertAudience", "audience", "versionBuilder", "identifier", "declaration", "datadogAppInputsVersion", "defineInputSchema", "declarationInput", "version", "latest", "olderVersions", "older", "definition", "datadogAppInputsDefinition", "publications", "publication", "createThemeInputs", "defineInputSchema", "value", "_enum", "schema", "createThemeInputs", "datadogTheme", "datadogTheme", "withInputBuildMarker", "createDatadogAppInputConsumer", "createDashboardInputs", "templateVariableSchema", "object", "string", "optional", "array", "timeframeSchema", "number", "boolean", "dashboardStateSchema", "defineInputSchema", "value", "schema", "createDashboardInputs", "datadogDashboard", "datadogDashboard", "withInputBuildMarker", "createDatadogAppInputConsumer", "createNotebookInputs", "templateVariableSchema", "object", "string", "optional", "array", "notebookStateSchema", "number", "boolean", "defineInputSchema", "value", "schema", "createNotebookInputs", "datadogNotebook", "datadogNotebook", "withInputBuildMarker", "createDatadogAppInputConsumer", "createServicePanelInputs", "defineInputSchema", "value", "string", "_minLength", "fn", "_undefined", "schema", "createServicePanelInputs", "datadogServicePanel", "datadogServicePanel", "withInputBuildMarker", "createDatadogAppInputConsumer"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
|
|
2
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
3
|
+
* Copyright 2019-Present Datadog, Inc.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
A as s,
|
|
8
|
+
E as d,
|
|
9
|
+
F as C,
|
|
10
|
+
G as p,
|
|
11
|
+
H as A,
|
|
12
|
+
I,
|
|
13
|
+
J as h,
|
|
14
|
+
K as S,
|
|
15
|
+
r as u,
|
|
16
|
+
s as l
|
|
17
|
+
} from "./chunk-E6L6DSL7.js";
|
|
18
|
+
|
|
19
|
+
// src/embedding/types.ts
|
|
20
|
+
var x = [
|
|
21
|
+
"datadog.idp.homepage",
|
|
22
|
+
"datadog.idp.service-panel",
|
|
23
|
+
"datadog.idp.self-service",
|
|
24
|
+
"datadog.app-builder",
|
|
25
|
+
"datadog.appsec",
|
|
26
|
+
"datadog.notebook",
|
|
27
|
+
"datadog.dashboard"
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
// src/embedding/versioning.ts
|
|
31
|
+
function b(e, n, t) {
|
|
32
|
+
let o = /* @__PURE__ */ Object.create(null), a = n;
|
|
33
|
+
for (let [r, i] of Object.entries(e.fields))
|
|
34
|
+
o[r] = i.kind === "value" ? a[r] : Object.freeze({
|
|
35
|
+
invoke: a[r]
|
|
36
|
+
});
|
|
37
|
+
return C(e, Object.freeze(o), t);
|
|
38
|
+
}
|
|
39
|
+
function F(e, n) {
|
|
40
|
+
let t = /* @__PURE__ */ Object.create(null);
|
|
41
|
+
for (let o of n)
|
|
42
|
+
t[o] = e[o];
|
|
43
|
+
return t;
|
|
44
|
+
}
|
|
45
|
+
function D(e, n) {
|
|
46
|
+
if (e.kind !== n.kind)
|
|
47
|
+
return !1;
|
|
48
|
+
if (e.kind === "value" && n.kind === "value")
|
|
49
|
+
return e.schema === n.schema;
|
|
50
|
+
if (e.kind === "function" && n.kind === "function") {
|
|
51
|
+
let t = Object.keys(e.inputs), o = Object.keys(n.inputs);
|
|
52
|
+
return !(t.length !== o.length || e.result !== n.result || t.some(
|
|
53
|
+
(a) => !Object.prototype.hasOwnProperty.call(n.inputs, a) || e.inputs[a] !== n.inputs[a]
|
|
54
|
+
));
|
|
55
|
+
}
|
|
56
|
+
return !1;
|
|
57
|
+
}
|
|
58
|
+
function L(e, n) {
|
|
59
|
+
let t = /* @__PURE__ */ Object.create(null);
|
|
60
|
+
for (let [o, a] of Object.entries(e.fields))
|
|
61
|
+
t[o] = a;
|
|
62
|
+
for (let o of n)
|
|
63
|
+
for (let [a, r] of Object.entries(o.extraInputs)) {
|
|
64
|
+
if (Object.prototype.hasOwnProperty.call(e.fields, a))
|
|
65
|
+
throw new Error(
|
|
66
|
+
`"${e.identifier}" v${o.contract.version} declares extra input "${a}", which already names a field of v${e.version}.`
|
|
67
|
+
);
|
|
68
|
+
let i = Object.prototype.hasOwnProperty.call(t, a) ? t[a] : void 0;
|
|
69
|
+
if (i && !D(i, r))
|
|
70
|
+
throw new Error(
|
|
71
|
+
`"${e.identifier}" extra input "${a}" is declared with conflicting schemas by more than one older version.`
|
|
72
|
+
);
|
|
73
|
+
t[a] = r;
|
|
74
|
+
}
|
|
75
|
+
return Object.freeze(t);
|
|
76
|
+
}
|
|
77
|
+
function R(e, ...n) {
|
|
78
|
+
let t = /* @__PURE__ */ new Set([e.version]);
|
|
79
|
+
for (let r of n) {
|
|
80
|
+
if (r.contract.identifier !== e.identifier)
|
|
81
|
+
throw new Error(
|
|
82
|
+
`Older version "${r.contract.identifier}" v${r.contract.version} must share identifier "${e.identifier}" with its latest contract.`
|
|
83
|
+
);
|
|
84
|
+
if (r.contract.version >= e.version)
|
|
85
|
+
throw new Error(
|
|
86
|
+
`Older version "${e.identifier}" v${r.contract.version} must be older than latest v${e.version}.`
|
|
87
|
+
);
|
|
88
|
+
if (t.has(r.contract.version))
|
|
89
|
+
throw new Error(
|
|
90
|
+
`"${e.identifier}" declares version ${r.contract.version} more than once.`
|
|
91
|
+
);
|
|
92
|
+
t.add(r.contract.version);
|
|
93
|
+
}
|
|
94
|
+
let o = L(e, n), a = Object.keys(e.fields);
|
|
95
|
+
return Object.freeze({
|
|
96
|
+
identifier: e.identifier,
|
|
97
|
+
latest: e,
|
|
98
|
+
// `Object.freeze` on the returned object is shallow: exposing the
|
|
99
|
+
// validated array by reference would let a caller mutate it (push,
|
|
100
|
+
// sort, splice) after the fact despite the wrapper looking frozen.
|
|
101
|
+
olderVersions: Object.freeze([...n]),
|
|
102
|
+
fields: o,
|
|
103
|
+
buildModules(r, i) {
|
|
104
|
+
let f = r, m = F(
|
|
105
|
+
f,
|
|
106
|
+
a
|
|
107
|
+
), O = [
|
|
108
|
+
b(e, m, i)
|
|
109
|
+
];
|
|
110
|
+
for (let c of n) {
|
|
111
|
+
let E = c.convert(
|
|
112
|
+
m,
|
|
113
|
+
F(
|
|
114
|
+
f,
|
|
115
|
+
Object.keys(c.extraInputs)
|
|
116
|
+
)
|
|
117
|
+
);
|
|
118
|
+
O.push(b(c.contract, E, i));
|
|
119
|
+
}
|
|
120
|
+
return Object.freeze(O);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// src/inputs/published-definition.ts
|
|
126
|
+
var y = /* @__PURE__ */ new WeakSet(), V = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/;
|
|
127
|
+
function g(e, n, t) {
|
|
128
|
+
if (!d.test(n) || n.length > l || !p(t))
|
|
129
|
+
throw new Error(
|
|
130
|
+
`Datadog App input field "${e}.${n}" must have a name matching ${String(d)} of at most ${l} characters and be a read-only value or function whose schemas implement Standard Schema V1.`
|
|
131
|
+
);
|
|
132
|
+
if (t.kind === "function") {
|
|
133
|
+
for (let o of Object.keys(t.inputs))
|
|
134
|
+
if (!d.test(o))
|
|
135
|
+
throw new Error(
|
|
136
|
+
`Datadog App input function parameter "${e}.${n}.${o}" must have a name matching ${String(d)}.`
|
|
137
|
+
);
|
|
138
|
+
if (!A(t))
|
|
139
|
+
throw new Error(
|
|
140
|
+
`Datadog App input function field "${e}.${n}" declares a timeoutMs no call could meet. It must be greater than 0 and at most ${2147483647}.`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function T(e) {
|
|
145
|
+
if (!s(e) || typeof e.identifier != "string" || !V.test(e.identifier))
|
|
146
|
+
throw new Error(
|
|
147
|
+
`Datadog App input contract identifier "${String(s(e) ? e.identifier : void 0)}" must match ${String(V)}.`
|
|
148
|
+
);
|
|
149
|
+
if (typeof e.version != "number" || !Number.isSafeInteger(e.version) || e.version < 1)
|
|
150
|
+
throw new Error(
|
|
151
|
+
`Datadog App input contract "${e.identifier}" must have a positive integer version.`
|
|
152
|
+
);
|
|
153
|
+
if (!s(e.fields) || Object.keys(e.fields).length === 0 || Object.keys(e.fields).length > u)
|
|
154
|
+
throw new Error(
|
|
155
|
+
`Datadog App input contract "${e.identifier}" must define between 1 and ${u} fields.`
|
|
156
|
+
);
|
|
157
|
+
for (let [n, t] of Object.entries(e.fields))
|
|
158
|
+
g(e.identifier, n, t);
|
|
159
|
+
}
|
|
160
|
+
function N(e, n) {
|
|
161
|
+
if (!s(n))
|
|
162
|
+
throw new Error(
|
|
163
|
+
`Older Datadog App input contract "${e}" must declare its extra inputs as an object.`
|
|
164
|
+
);
|
|
165
|
+
for (let [t, o] of Object.entries(n))
|
|
166
|
+
g(e, t, o);
|
|
167
|
+
}
|
|
168
|
+
var K = /* @__PURE__ */ Object.freeze({
|
|
169
|
+
readOnly(e) {
|
|
170
|
+
return I.readOnly(e);
|
|
171
|
+
}
|
|
172
|
+
}), q = /* @__PURE__ */ Object.freeze({
|
|
173
|
+
readOnly(e) {
|
|
174
|
+
return h.readOnly(
|
|
175
|
+
e
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
function _(e) {
|
|
180
|
+
let n = S(
|
|
181
|
+
e
|
|
182
|
+
);
|
|
183
|
+
return T(n), n;
|
|
184
|
+
}
|
|
185
|
+
function W(e) {
|
|
186
|
+
let n = e, t = "latest" in n ? n.latest : _(
|
|
187
|
+
n
|
|
188
|
+
), o = n.olderVersions ?? [];
|
|
189
|
+
T(t);
|
|
190
|
+
for (let i of o)
|
|
191
|
+
T(i.contract), N(t.identifier, i.extraInputs);
|
|
192
|
+
let a = R(t, ...o), r = Object.freeze({
|
|
193
|
+
...a,
|
|
194
|
+
surfaces: Object.freeze([
|
|
195
|
+
...n.surfaces ?? x
|
|
196
|
+
])
|
|
197
|
+
});
|
|
198
|
+
return y.add(r), r;
|
|
199
|
+
}
|
|
200
|
+
function Z(e, n = e.latest) {
|
|
201
|
+
if (w(e), n !== e.latest && !e.olderVersions.some(
|
|
202
|
+
(o) => s(o) && o.contract === n
|
|
203
|
+
))
|
|
204
|
+
throw new Error(
|
|
205
|
+
"The consumer contract must be a version served by its host definition."
|
|
206
|
+
);
|
|
207
|
+
let t = Object.freeze({
|
|
208
|
+
identifier: e.identifier,
|
|
209
|
+
latest: n,
|
|
210
|
+
fields: n.fields,
|
|
211
|
+
surfaces: e.surfaces
|
|
212
|
+
});
|
|
213
|
+
return y.add(t), t;
|
|
214
|
+
}
|
|
215
|
+
var P = /* @__PURE__ */ new WeakMap();
|
|
216
|
+
function X(e, n) {
|
|
217
|
+
return P.set(e, n), e;
|
|
218
|
+
}
|
|
219
|
+
function w(e) {
|
|
220
|
+
if (typeof e != "object" || e === null || !y.has(e))
|
|
221
|
+
throw new Error(
|
|
222
|
+
"useDatadogAppInput() requires a definition exported by @datadog/apps-frontend/inputs/schema."
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export {
|
|
227
|
+
K as a,
|
|
228
|
+
q as b,
|
|
229
|
+
_ as c,
|
|
230
|
+
W as d,
|
|
231
|
+
Z as e,
|
|
232
|
+
X as f,
|
|
233
|
+
w as g
|
|
234
|
+
};
|
|
235
|
+
//# sourceMappingURL=chunk-BWBMAWDD.js.map
|