@datadog/apps-frontend 0.0.2 → 0.0.4
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/LICENSES-3rdparty.csv +1 -0
- package/README.md +10 -4
- package/dist/src/_chunks/chunk-2V2HASKF.js +7 -0
- package/dist/src/_chunks/chunk-2V2HASKF.js.map +7 -0
- package/dist/src/_chunks/chunk-T34NWJ7R.js +7 -0
- package/dist/src/_chunks/chunk-T34NWJ7R.js.map +7 -0
- package/dist/src/_chunks/chunk-X34MSTJH.js +7 -0
- package/dist/src/_chunks/chunk-X34MSTJH.js.map +7 -0
- package/dist/src/embedding/react/index.js +1 -1
- package/dist/src/embedding/react/index.js.map +4 -4
- package/dist/src/embedding/types.d.ts +55 -6
- package/dist/src/embedding/versioning.d.ts +104 -0
- package/dist/src/inputs/published-definition.d.ts +152 -0
- package/dist/src/inputs/react/index.d.ts +7 -0
- package/dist/src/inputs/react/index.js +7 -0
- package/dist/src/inputs/react/index.js.map +7 -0
- package/dist/src/inputs/react/use-datadog-app-input.d.ts +54 -0
- package/dist/src/inputs/schemas/dashboard.d.ts +30 -0
- package/dist/src/inputs/schemas/index.d.ts +25 -0
- package/dist/src/inputs/schemas/index.js +7 -0
- package/dist/src/inputs/schemas/index.js.map +7 -0
- package/dist/src/inputs/schemas/theme.d.ts +15 -0
- package/dist/src/inputs/types.d.ts +50 -0
- package/package.json +21 -4
|
@@ -0,0 +1,50 @@
|
|
|
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 type { AnyContract, AnyField, AnySchema, ClaimedValues, FunctionField, FunctionInputs, HostFunctionContext, InferOf, ValueField } from '../embedding/types.js';
|
|
7
|
+
import type { UnionToIntersection } from '../embedding/versioning.js';
|
|
8
|
+
/**
|
|
9
|
+
* Anything a host supplies values for: one flat namespace of fields. An
|
|
10
|
+
* inputs definition satisfies this with the union of every version's fields,
|
|
11
|
+
* which is why a provider never sees the versions individually.
|
|
12
|
+
*/
|
|
13
|
+
export type AnyFieldsOwner = Readonly<{
|
|
14
|
+
fields: Readonly<Record<string, AnyField>>;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* The one flat namespace covering a whole set of definitions: every field of
|
|
18
|
+
* every definition, and so of every version of each. Surfaces and definitions
|
|
19
|
+
* relate many-to-many, so a host provides a set rather than one definition and
|
|
20
|
+
* populates a single record for the lot -- learning neither how many
|
|
21
|
+
* definitions are behind it nor how many versions are behind those.
|
|
22
|
+
*/
|
|
23
|
+
export type MergedFieldsOwner<TDefinitions extends readonly AnyFieldsOwner[]> = Readonly<{
|
|
24
|
+
fields: Readonly<{
|
|
25
|
+
[TKey in keyof UnionToIntersection<TDefinitions[number]['fields']>]: UnionToIntersection<TDefinitions[number]['fields']>[TKey] extends AnyField ? UnionToIntersection<TDefinitions[number]['fields']>[TKey] : never;
|
|
26
|
+
}>;
|
|
27
|
+
}>;
|
|
28
|
+
/** The values a resolved claim on one inputs definition carries. */
|
|
29
|
+
export type DatadogAppInputsHostValues<TSchema extends Readonly<{
|
|
30
|
+
latest: AnyContract;
|
|
31
|
+
}>> = ClaimedValues<TSchema['latest']>;
|
|
32
|
+
type HostImplementation<TField extends AnyField> = TField extends ValueField<infer TSchema> ? InferOf<TSchema> : TField extends FunctionField<infer TInputs, infer TResult> ? (inputs: FunctionInputs<TInputs>, context: HostFunctionContext) => InferOf<TResult> | Promise<InferOf<TResult>> : never;
|
|
33
|
+
export type FieldsHostImplementation<TFields extends Record<string, AnyField>> = Readonly<{
|
|
34
|
+
[TKey in keyof TFields]: HostImplementation<TFields[TKey]>;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Every value a host must supply for one inputs definition, in one flat
|
|
38
|
+
* record: the latest version's own fields alongside the extra inputs older
|
|
39
|
+
* versions need, with nothing marking which is which.
|
|
40
|
+
*/
|
|
41
|
+
export type DatadogAppInputImplementations<TSchema extends AnyFieldsOwner> = FieldsHostImplementation<TSchema['fields']>;
|
|
42
|
+
export type DatadogAppInputValueUpdates<TSchema extends AnyFieldsOwner> = Readonly<{
|
|
43
|
+
[TKey in keyof TSchema['fields'] as TSchema['fields'][TKey] extends ValueField<AnySchema> ? TKey : never]: TSchema['fields'][TKey] extends ValueField<infer TSchema2> ? InferOf<TSchema2> : never;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* `update()`'s shape: unlike construction, a caller only names the value
|
|
47
|
+
* fields it wants to change, so every field is optional.
|
|
48
|
+
*/
|
|
49
|
+
export type DatadogAppInputPartialValueUpdates<TSchema extends AnyFieldsOwner> = Partial<DatadogAppInputValueUpdates<TSchema>>;
|
|
50
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datadog/apps-frontend",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "React inputs for Datadog Apps",
|
|
6
6
|
"homepage": "https://datadoghq.com",
|
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
"./embedding/react": {
|
|
29
29
|
"types": "./dist/src/embedding/react/index.d.ts",
|
|
30
30
|
"default": "./dist/src/embedding/react/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./inputs/react": {
|
|
33
|
+
"types": "./dist/src/inputs/react/index.d.ts",
|
|
34
|
+
"default": "./dist/src/inputs/react/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./inputs/schema": {
|
|
37
|
+
"types": "./dist/src/inputs/schemas/index.d.ts",
|
|
38
|
+
"default": "./dist/src/inputs/schemas/index.js"
|
|
31
39
|
}
|
|
32
40
|
},
|
|
33
41
|
"publishConfig": {
|
|
@@ -43,6 +51,14 @@
|
|
|
43
51
|
"./embedding/react": {
|
|
44
52
|
"types": "./dist/src/embedding/react/index.d.ts",
|
|
45
53
|
"default": "./dist/src/embedding/react/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./inputs/react": {
|
|
56
|
+
"types": "./dist/src/inputs/react/index.d.ts",
|
|
57
|
+
"default": "./dist/src/inputs/react/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./inputs/schema": {
|
|
60
|
+
"types": "./dist/src/inputs/schemas/index.d.ts",
|
|
61
|
+
"default": "./dist/src/inputs/schemas/index.js"
|
|
46
62
|
}
|
|
47
63
|
},
|
|
48
64
|
"access": "public"
|
|
@@ -55,9 +71,11 @@
|
|
|
55
71
|
},
|
|
56
72
|
"dependencies": {
|
|
57
73
|
"@standard-schema/spec": "1.1.0",
|
|
58
|
-
"penpal": "7.0.6"
|
|
74
|
+
"penpal": "7.0.6",
|
|
75
|
+
"zod": "4.3.6"
|
|
59
76
|
},
|
|
60
77
|
"devDependencies": {
|
|
78
|
+
"@fast-check/jest": "2.0.3",
|
|
61
79
|
"@testing-library/react": "16.3.0",
|
|
62
80
|
"@types/datadog": "workspace:*",
|
|
63
81
|
"@types/node": "catalog:",
|
|
@@ -66,8 +84,7 @@
|
|
|
66
84
|
"esbuild": "0.27.5",
|
|
67
85
|
"react": "catalog:",
|
|
68
86
|
"react-dom": "catalog:",
|
|
69
|
-
"typescript": "patch:typescript%40npm%3A6.0.2#~/.yarn/patches/typescript-npm-6.0.2-no-dts-errors.patch"
|
|
70
|
-
"zod": "4.3.6"
|
|
87
|
+
"typescript": "patch:typescript%40npm%3A6.0.2#~/.yarn/patches/typescript-npm-6.0.2-no-dts-errors.patch"
|
|
71
88
|
},
|
|
72
89
|
"peerDependencies": {
|
|
73
90
|
"react": "^18.0.0 || ^19.0.0"
|