@picked/client 0.0.1-dev.1786675074931 → 0.0.1-dev.1787537193674

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 (91) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/api-4YpcWP-x.js +33 -0
  3. package/dist/api-DRTduQVm.cjs +1 -0
  4. package/dist/cjs/index.js +2 -2
  5. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  6. package/dist/cjs/plugins/telemetry/index.js +1 -0
  7. package/dist/cjs/server/index.js +1 -1
  8. package/dist/docs/_root.css +101 -0
  9. package/dist/docs/explanation/feature-flag-allocation.md +43 -1
  10. package/dist/docs/how-to/analytics/index.md +2 -0
  11. package/dist/docs/how-to/authenticate-the-cli.md +15 -13
  12. package/dist/docs/how-to/create-and-revoke-an-api-key.md +7 -2
  13. package/dist/docs/how-to/debug-with-the-chrome-extension.md +1 -1
  14. package/dist/docs/how-to/install-the-sdk.md +30 -12
  15. package/dist/docs/how-to/install-the-vite-plugin.md +22 -9
  16. package/dist/docs/how-to/read-a-feature-flag.md +23 -11
  17. package/dist/docs/how-to/read-a-referenced-entry.md +4 -6
  18. package/dist/docs/how-to/register-a-component.md +2 -2
  19. package/dist/docs/how-to/register-an-action-handler.md +1 -1
  20. package/dist/docs/how-to/render-a-step-form.md +3 -4
  21. package/dist/docs/how-to/server-render-a-page.md +1 -1
  22. package/dist/docs/how-to/switch-workspaces.md +1 -2
  23. package/dist/docs/how-to/write-a-predicate.md +1 -1
  24. package/dist/docs/reference/dashboard/api-keys.mdx +5 -4
  25. package/dist/docs/reference/dashboard/features.mdx +45 -5
  26. package/dist/docs/reference/delivery-api/workspace-schema.md +12 -1
  27. package/dist/docs/reference/pickedql/dimensions.md +16 -0
  28. package/dist/docs/reference/pickedql/virtual-functions.md +16 -5
  29. package/dist/docs/reference/sdk/analytics-events.md +445 -0
  30. package/dist/docs/reference/sdk/content.md +7 -10
  31. package/dist/docs/reference/sdk/features.md +18 -7
  32. package/dist/docs/reference/sdk/plugins/dynamic-experiences.md +1 -1
  33. package/dist/docs/reference/sdk/plugins/window-object.md +1 -1
  34. package/dist/docs/reference/sdk/ssr/serialize.md +1 -1
  35. package/dist/docs/reference/sdk/steps.md +3 -4
  36. package/dist/docs/reference/sdk/type-generation.md +65 -26
  37. package/dist/docs/reference/tools/cli.md +19 -14
  38. package/dist/docs/reference/tools/vite-plugin.md +28 -6
  39. package/dist/docs/tutorials/first-experience.mdx +6 -7
  40. package/dist/docs/tutorials/first-server-rendered-page.mdx +3 -3
  41. package/dist/emit-D-tLiWL1.cjs +1 -0
  42. package/dist/emit-Ds2EG7CB.js +14 -0
  43. package/dist/esm/index.js +255 -232
  44. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  45. package/dist/esm/plugins/telemetry/index.js +94 -0
  46. package/dist/esm/server/index.js +1 -1
  47. package/dist/plugin-BPZV7SJg.cjs +1 -0
  48. package/dist/{plugin-ClKkYGTd.js → plugin-DTN7fsyp.js} +44 -29
  49. package/dist/{provider-D7msjLQ1.cjs → provider-BxhVIcsp.cjs} +1 -1
  50. package/dist/{provider-BEpf8z6A.js → provider-DLebj-AW.js} +1 -1
  51. package/dist/request-observer-BXDfOU0V.cjs +1 -0
  52. package/dist/request-observer-DtG0cRfz.js +19 -0
  53. package/dist/types/data-source/api.d.ts.map +1 -1
  54. package/dist/types/data-source/provider.d.ts +11 -1
  55. package/dist/types/data-source/provider.d.ts.map +1 -1
  56. package/dist/types/data-source/request-observer.d.ts +46 -0
  57. package/dist/types/data-source/request-observer.d.ts.map +1 -0
  58. package/dist/types/entities/feature/feature.d.ts +10 -3
  59. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  60. package/dist/types/index.d.ts +1 -1
  61. package/dist/types/index.d.ts.map +1 -1
  62. package/dist/types/lifecycle/lifecycle.d.ts.map +1 -1
  63. package/dist/types/picked.d.ts +12 -2
  64. package/dist/types/picked.d.ts.map +1 -1
  65. package/dist/types/plugins/dynamic-experiences/hash.d.ts +53 -1
  66. package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +1 -1
  67. package/dist/types/plugins/dynamic-experiences/index.d.ts +1 -0
  68. package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
  69. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +1 -1
  70. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  71. package/dist/types/plugins/dynamic-experiences/types.d.ts +3 -4
  72. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  73. package/dist/types/plugins/telemetry/emit.d.ts +18 -0
  74. package/dist/types/plugins/telemetry/emit.d.ts.map +1 -0
  75. package/dist/types/plugins/telemetry/index.d.ts +4 -0
  76. package/dist/types/plugins/telemetry/index.d.ts.map +1 -0
  77. package/dist/types/plugins/telemetry/plugin-summary.d.ts +10 -0
  78. package/dist/types/plugins/telemetry/plugin-summary.d.ts.map +1 -0
  79. package/dist/types/plugins/telemetry/plugin.d.ts +29 -0
  80. package/dist/types/plugins/telemetry/plugin.d.ts.map +1 -0
  81. package/dist/types/schema-registry.d.ts +16 -0
  82. package/dist/types/schema-registry.d.ts.map +1 -1
  83. package/dist/types/utils/user-timing.d.ts +18 -0
  84. package/dist/types/utils/user-timing.d.ts.map +1 -0
  85. package/dist/version-BlahSDlG.cjs +1 -0
  86. package/dist/{version-CTwGfdI4.js → version-BmBn0dXR.js} +1 -1
  87. package/package.json +16 -4
  88. package/dist/api-CSNjsqCv.js +0 -22
  89. package/dist/api-yuvsQhNy.cjs +0 -1
  90. package/dist/plugin-D4-caxZN.cjs +0 -1
  91. package/dist/version-CRxCADU7.cjs +0 -1
@@ -7,8 +7,6 @@ layout: docs
7
7
 
8
8
  Picked can generate TypeScript types from your workspace schema so field values, feature keys, content models, and step layouts are typed in your app.
9
9
 
10
- The generated file augments the `PickedSchemaRegistry` interface of `@picked/client`. Your IDE reads the types as soon as the declaration file is part of your TypeScript project.
11
-
12
10
  ## Quick start
13
11
 
14
12
  ### 1. Add `picked.config.ts`
@@ -16,40 +14,48 @@ The generated file augments the `PickedSchemaRegistry` interface of `@picked/cli
16
14
  Create a `picked.config.ts` in your project root:
17
15
 
18
16
  ```typescript
19
- import { defineConfig } from '@picked/config'
17
+ import { defineConfig } from 'picked/config'
20
18
 
21
19
  export default defineConfig({
22
20
  projectId: 'your-project-id',
23
- apiUrl: 'https://api.picked.app',
24
21
  typesOutput: './src/picked-env.d.ts',
25
- source: 'published',
26
22
  })
27
23
  ```
28
24
 
29
25
  | Option | Description |
30
26
  | --- | --- |
31
27
  | `projectId` | **Required.** Your Picked project id. |
32
- | `apiUrl` | API origin (defaults to `https://api.picked.app`). |
33
28
  | `typesOutput` | Path for generated types (defaults to `./src/picked-env.d.ts`). |
34
29
  | `source` | Schema surface to type against: `'published'` (default) or `'preview'`. |
35
30
  | `previewToken` | Workspace preview token. Required when `source` is `'preview'`, and read only then. |
36
31
 
37
32
  The `source` value matches the `x-picked-source` field on the [workspace schema](/reference/delivery-api/workspace-schema) document — it controls whether tooling fetches the published or preview workspace shape.
38
33
 
39
- A preview token is a long-lived, unexpiring, workspace-scoped secret. Keep it out of
40
- version control by reading it from wherever your project holds secrets:
34
+ A preview token reads one workspace, and it does not expire. Leave both `source` and
35
+ `previewToken` out of the committed file, and pick a workspace instead:
36
+
37
+ ```bash
38
+ picked login
39
+ picked workspace use
40
+ ```
41
+
42
+ That writes the choice, and that workspace's token, to `.picked/settings.json`, which is
43
+ per-developer and which Git ignores. Each developer points at their own workspace, and the
44
+ committed file holds no token.
45
+
46
+ You can also set the values here. Every developer then reads the same workspace:
41
47
 
42
48
  ```typescript
43
49
  export default defineConfig({
44
50
  projectId: 'your-project-id',
45
51
  source: 'preview',
46
- previewToken: process.env.PICKED_PREVIEW_TOKEN,
52
+ previewToken: 'the-workspace-preview-token',
47
53
  })
48
54
  ```
49
55
 
50
- Tooling resolves the token from the first source that supplies one: the
51
- `PICKED_PREVIEW_TOKEN` environment variable, then the workspace chosen with
52
- [`picked workspace use`](/reference/tools/cli), then this `previewToken` option.
56
+ Three places can give the token. Tooling reads the first of them that has one: the
57
+ `PICKED_PREVIEW_TOKEN` environment variable, then the workspace that
58
+ [`picked workspace use`](/reference/tools/cli) chose, then this `previewToken` option.
53
59
 
54
60
  ### 2. Enable the Vite plugin (recommended)
55
61
 
@@ -59,30 +65,47 @@ If you use Vite, add `@picked/vite-plugin-picked`. Type generation runs automati
59
65
  import { picked } from '@picked/vite-plugin-picked'
60
66
 
61
67
  export default defineConfig({
62
- plugins: [
63
- picked({ disableLauncher: true }),
64
- ],
68
+ plugins: [picked()],
65
69
  })
66
70
  ```
67
71
 
68
- Project identity (`projectId`, `apiUrl`) comes from `picked.config.ts` — the plugin only accepts Vite-specific options:
69
-
70
- | Option | Default | Description |
71
- | --- | --- | --- |
72
- | `generateTypes` | `true` | Read the workspace schema and write types, in development and in a build. |
73
- | `disableLauncher` | `false` | Turn off the HTML page of the dev launcher. |
74
-
75
- Set `generateTypes: false` in a nested Vite build that must not regenerate types, such as a build for one more entry point.
72
+ The project id comes from `picked.config.ts`. A failure stops the
73
+ run. See [the plugin reference](/reference/tools/vite-plugin) for `generateTypes` and every
74
+ other option.
76
75
 
77
76
  ### 3. Or use the CLI
78
77
 
79
- Install `@picked/cli` and run:
78
+ Install [`picked`](/reference/tools/cli) and run:
80
79
 
81
80
  ```bash
82
81
  picked generate types
83
82
  ```
84
83
 
85
- In CI, `--check` writes no file and fails when the types are stale. See the [CLI reference](/reference/tools/cli) for each command.
84
+ ## Keep the types current
85
+
86
+ Commit `picked-env.d.ts`. A workspace changes after you commit it, so the file goes stale,
87
+ and stale types describe fields your workspace no longer has.
88
+
89
+ Run this check in CI, next to your other checks:
90
+
91
+ ```bash
92
+ picked generate types --check
93
+ ```
94
+
95
+ `--check` writes no file. It reads the live workspace schema and compares it with the
96
+ committed file. A match gives status `0`. A difference gives status `1` and names the file:
97
+
98
+ ```
99
+ Types are out of date: /home/runner/work/your-app/src/picked-env.d.ts
100
+ ```
101
+
102
+ To clear it, run `picked generate types` and commit the result. The check reads no cached
103
+ schema, so an API it cannot reach fails the check.
104
+
105
+ :::note
106
+ `--check` reads the workspace that the resolved configuration names. A CI run that has no
107
+ `.picked/settings.json` reads the workspace your committed `picked.config.ts` names.
108
+ :::
86
109
 
87
110
  ## Workspace selection
88
111
 
@@ -101,7 +124,7 @@ The generated `picked-env.d.ts` file looks like:
101
124
 
102
125
  export interface WelcomePage { /* ... */ }
103
126
  export interface FieldValues { /* ... */ }
104
- export type FeatureKey = 'default' | 'winter-sale'
127
+ export type FeatureKey = 'default' | 'hero' | 'winter-sale'
105
128
 
106
129
  declare module '@picked/client' {
107
130
  interface PickedSchemaRegistry {
@@ -109,12 +132,28 @@ declare module '@picked/client' {
109
132
  stepContentModels: { intro: 'welcome-page' }
110
133
  fieldValues: FieldValues
111
134
  featureKeys: FeatureKey
135
+ featureValues: { hero: false | 'hero-a' | 'hero-b' }
112
136
  }
113
137
  }
114
138
  ```
115
139
 
116
140
  Commit this file to the version control system, or regenerate it in CI after you publish a workspace change.
117
141
 
142
+ ### Feature flag values
143
+
144
+ A Text feature flag declares the values that it can serve, so `useFeatureResult` narrows
145
+ the bucket to those values:
146
+
147
+ ```typescript
148
+ const result = useFeatureResult('hero')
149
+ ```
150
+
151
+ The `bucket` property then has the type `false | 'hero-a' | 'hero-b'`.
152
+
153
+ `featureValues` holds the Text feature flags alone. A Boolean feature flag, and a feature
154
+ flag that your application defines, both keep the general `boolean | string` type. The
155
+ `FeatureValueFor<'hero'>` type gives the same union on its own.
156
+
118
157
  ## Keys the application defines
119
158
 
120
159
  An application can define a feature, an action, a field, a step, or an experience of its
@@ -5,18 +5,24 @@ layout: docs
5
5
 
6
6
  # CLI
7
7
 
8
- `@picked/cli` is the command-line tool for local Picked development. It generates
9
- TypeScript types from your workspace schema and lets you switch which project or workspace
10
- your local tooling loads — without hand-editing `picked.config.ts`.
8
+ `picked` is the command-line tool for local Picked development. It generates TypeScript
9
+ types from your workspace schema and lets you switch which project or workspace your local
10
+ tooling loads — without hand-editing `picked.config.ts`.
11
11
 
12
12
  ## Installation
13
13
 
14
- `@picked/cli` installs as a dev dependency and gives you the binary `picked`. It reads
15
- `picked.config.ts` from the current directory, so it runs from your project root. See
16
- [How to authenticate the CLI](/how-to/authenticate-the-cli) to install it and sign in.
14
+ The [`picked`](/reference/sdk) package holds this command, the client, and the
15
+ `picked.config` helpers:
17
16
 
18
- The `picked` package holds this command too, so a project that installs `picked` has it
19
- already.
17
+ ```bash
18
+ npm install picked
19
+ ```
20
+
21
+ The command reads `picked.config.ts` from the current directory, so run it from your
22
+ project root. See [How to authenticate the CLI](/how-to/authenticate-the-cli) to sign in.
23
+
24
+ `@picked/cli` holds the command on its own, for a project that wants no other part of the
25
+ package.
20
26
 
21
27
  ## Commands
22
28
 
@@ -24,7 +30,7 @@ already.
24
30
  | --- | --- |
25
31
  | `picked login` | Sign in with your browser (OAuth) to the API origin of the current directory. Stores a session under `~/.picked/auth/`. |
26
32
  | `picked logout` | Clear the stored session for the current directory's API origin. |
27
- | `picked whoami` | Print the identity signed in to the API origin of the current directory, or report that `PICKED_TOKEN` is in use. |
33
+ | `picked whoami` | Print the identity signed in to the API origin of the current directory. |
28
34
  | `picked status` | Print the resolved selection and the committed `picked.config` default. |
29
35
  | `picked workspace list` | List each org, project, and workspace that you can read. Alias `ls`. `--json` gives machine output. |
30
36
  | `picked workspace use` | Set the active project or workspace. Alias `picked use`. Interactive, or `--project` and `--workspace`. |
@@ -101,9 +107,8 @@ a session for another API.
101
107
  | --- | --- |
102
108
  | `~/.picked/auth/<origin>.json` | The OAuth session for one API origin — access token, refresh token, expiry — with the CLI's registered client id for that origin. File mode `600`. Refreshed as it nears expiry. |
103
109
 
104
- `PICKED_TOKEN` supersedes each stored session and needs no browser, which is what a CI run
105
- uses. An API deployment with no OAuth client registration rejects `picked login`, and has
106
- no other flow.
110
+ An API deployment with no OAuth client registration rejects `picked login`, and has no
111
+ other flow.
107
112
 
108
113
  A CLI session is a developer credential. It is not an
109
114
  [API key](/reference/dashboard/api-keys), which authenticates server-to-server calls, and
@@ -114,7 +119,6 @@ not [dashboard sign-in](/reference/management-api/authentication).
114
119
  | Variable | Effect |
115
120
  | --- | --- |
116
121
  | `PICKED_API_URL` | The API origin that the CLI reads. Supersedes `picked.config` `apiUrl` and the `https://api.picked.app` default. |
117
- | `PICKED_TOKEN` | An access token in place of the stored session, for a CI or headless run. `picked login` is then not needed. |
118
122
  | `PICKED_PROJECT_ID` | Supersedes the resolved project id, above the active selection and the committed configuration. |
119
123
  | `PICKED_PREVIEW_TOKEN` | Supersedes the preview token. Applies only when the resolved source is `preview`. |
120
124
 
@@ -124,7 +128,8 @@ Tooling — `picked generate types` and the
124
128
  [Vite plugin](/reference/tools/vite-plugin) — resolves the configuration in this order. Each
125
129
  layer supersedes the layer before it:
126
130
 
127
- 1. **`picked.config.ts`** — the committed default, `projectId` and `source`.
131
+ 1. **`picked.config.ts`** — the committed default: `projectId`, `source`, and
132
+ `previewToken`.
128
133
  2. **`.picked/settings.json`** — the per-developer active selection that
129
134
  `picked workspace use` writes. It supersedes `projectId` and `source`, and Git ignores it.
130
135
  3. **Environment variables** — `PICKED_PROJECT_ID` and `PICKED_PREVIEW_TOKEN` supersede
@@ -106,12 +106,34 @@ After the dev server starts, the launcher URL appears next to the Vite output:
106
106
 
107
107
  ## Options
108
108
 
109
- | Option | Type | Default | Description |
110
- | ---------------- | --------------------- | ------------------------ | --------------------------------------------------------- |
111
- | `projectId` | `string` | — | **Required.** The ID of your Picked project. |
112
- | `apiUrl` | `string` | `https://api.picked.app` | Your own API URL, for a self-hosted or local API. |
113
- | `disableLauncher`| `boolean` | `false` | Turns the launcher page off in both dev and build output. |
114
- | `mode` | `'bundle' \| 'api'` | `'bundle'` | Whether the build carries your project data. |
109
+ Project identity belongs in [`picked.config.ts`](/reference/sdk/type-generation). The two
110
+ options that carry it are deprecated, and the table marks them.
111
+
112
+ | Option | Type | Default | Description |
113
+ | ---------------- | --------------------- | ------------------------ | ---------------------------------------------------------- |
114
+ | `disableLauncher`| `boolean` | `false` | Turns the launcher page off in both dev and build output. |
115
+ | `generateTypes` | `boolean` | `true` | Whether the plugin writes types from the workspace schema. |
116
+ | `mode` | `'bundle' \| 'api'` | `'bundle'` | Whether the build carries your project data. |
117
+ | `projectId` | `string` | — | **Deprecated.** Use `picked.config.ts`. |
118
+ | `apiUrl` | `string` | — | **Deprecated.** Use `picked.config.ts`. |
119
+
120
+ ### projectId and apiUrl
121
+
122
+ These two options moved to [`picked.config.ts`](/reference/sdk/type-generation), which the
123
+ `picked` command and type generation also read. A later release removes them.
124
+
125
+ The plugin still reads an option for a field that `picked.config.ts` leaves out, so a
126
+ project that has yet to move needs no change. It stops when the two values are different,
127
+ rather than choose one for you.
128
+
129
+ ### generateTypes
130
+
131
+ The plugin reads the workspace schema and writes `picked-env.d.ts`, on `vite dev` and on
132
+ `vite build`. [Type generation](/reference/sdk/type-generation) describes the output and
133
+ the `picked.config.ts` options that control it.
134
+
135
+ A failure stops the run. Set `generateTypes: false` for a build that must not write types,
136
+ such as a build for one more entry point.
115
137
 
116
138
  ### mode
117
139
 
@@ -102,11 +102,11 @@ Install the client and the adapter for your framework.
102
102
  :::code-group
103
103
 
104
104
  ```bash [React]
105
- npm install @picked/client @picked/react effector effector-react
105
+ npm install picked @picked/react
106
106
  ```
107
107
 
108
108
  ```bash [Svelte]
109
- npm install @picked/client @picked/svelte effector
109
+ npm install picked @picked/svelte
110
110
  ```
111
111
 
112
112
  :::
@@ -118,12 +118,11 @@ puts each one in a form.
118
118
  :::code-group
119
119
 
120
120
  ```tsx [React]
121
- import { useStep } from '@picked/react/hooks'
122
- import { useUnit } from 'effector-react'
121
+ import { useStep, useStoreGlobal } from '@picked/react/hooks'
123
122
 
124
123
  export function ColorSurvey() {
125
124
  const { fields, form } = useStep()
126
- const currentFields = useUnit(fields)
125
+ const currentFields = useStoreGlobal(fields)
127
126
 
128
127
  return (
129
128
  <form {...form.props}>
@@ -177,7 +176,7 @@ match the component name that you entered in step 4.
177
176
  :::code-group
178
177
 
179
178
  ```tsx [React]
180
- import { createClient } from '@picked/client'
179
+ import { createClient } from 'picked'
181
180
  import { dynamicExperiencesPlugin } from '@picked/client/plugins/dynamic-experiences'
182
181
  import { adaptReactComponent } from '@picked/react'
183
182
  import { reactFrameworkPlugin } from '@picked/react/plugins/framework'
@@ -195,7 +194,7 @@ picked.start()
195
194
  ```
196
195
 
197
196
  ```ts [Svelte]
198
- import { createClient } from '@picked/client'
197
+ import { createClient } from 'picked'
199
198
  import { dynamicExperiencesPlugin } from '@picked/client/plugins/dynamic-experiences'
200
199
  import { adaptSvelteComponent } from '@picked/svelte'
201
200
  import { svelteFrameworkPlugin } from '@picked/svelte/plugins/framework'
@@ -76,7 +76,7 @@ a snapshot as plain JSON.
76
76
  Make one client for each request, in `server.ts`:
77
77
 
78
78
  ```ts
79
- import { createClient } from '@picked/client'
79
+ import { createClient } from 'picked'
80
80
  import { serialize } from '@picked/client/server'
81
81
 
82
82
  const client = createClient(options)
@@ -107,7 +107,7 @@ Register the component under the same name that the page uses. Here it is `CMSPa
107
107
  :::code-group
108
108
 
109
109
  ```tsx [React]
110
- import type { CreateClientOptions } from '@picked/client'
110
+ import type { CreateClientOptions } from 'picked'
111
111
  import { dynamicExperiencesPlugin } from '@picked/client/plugins/dynamic-experiences'
112
112
  import { adaptReactComponent, ExperienceSlot, PickedProvider } from '@picked/react'
113
113
  import { reactFrameworkPlugin } from '@picked/react/plugins/framework'
@@ -136,7 +136,7 @@ export function Page({ snapshot }) {
136
136
 
137
137
  ```svelte [Svelte]
138
138
  <script lang="ts">
139
- import type { CreateClientOptions } from '@picked/client'
139
+ import type { CreateClientOptions } from 'picked'
140
140
  import { dynamicExperiencesPlugin } from '@picked/client/plugins/dynamic-experiences'
141
141
  import { adaptSvelteComponent, ExperienceSlot, setPickedContext } from '@picked/svelte'
142
142
  import { svelteFrameworkPlugin } from '@picked/svelte/plugins/framework'
@@ -0,0 +1 @@
1
+ let e=require("@picked/telemetry");async function t(t,n,r){let i=(0,e.createTelemetryEmitter)({endpoint:t,resource:n,headers:{"Picked-Telemetry":`sdk`},maxBatchSize:r.length||1});for(let e of r)i.record(e);await i.flush()}exports.flushSpans=t;
@@ -0,0 +1,14 @@
1
+ import { createTelemetryEmitter as e } from "@picked/telemetry";
2
+ //#region src/plugins/telemetry/emit.ts
3
+ async function t(t, n, r) {
4
+ let i = e({
5
+ endpoint: t,
6
+ resource: n,
7
+ headers: { "Picked-Telemetry": "sdk" },
8
+ maxBatchSize: r.length || 1
9
+ });
10
+ for (let e of r) i.record(e);
11
+ await i.flush();
12
+ }
13
+ //#endregion
14
+ export { t as flushSpans };