picked 0.0.117-next.2 → 0.0.117
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/.tsbuildinfo +1 -1
- package/dist/cjs/bin.d.ts +10 -0
- package/dist/cjs/bin.d.ts.map +1 -0
- package/dist/cjs/config.d.ts +8 -0
- package/dist/cjs/config.d.ts.map +1 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/docs/reference/apps/app-kit.md +2 -2
- package/docs/reference/apps/protocol.md +1 -1
- package/docs/reference/dashboard/workflow-templates.md +44 -7
- package/docs/reference/dashboard/workflow-test-runs.md +5 -4
- package/docs/reference/management-api/schema/field.md +5 -3
- package/docs/reference/management-api/schema/index.md +4 -1
- package/docs/reference/management-api/schema/lead.md +262 -12
- package/docs/reference/management-api/schema/workflow.md +10 -6
- package/package.json +22 -12
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The `picked` command.
|
|
3
|
+
*
|
|
4
|
+
* A package manager links only a direct dependency's binaries, so depending on
|
|
5
|
+
* `@picked/cli` does not put `picked` on a consumer's PATH — this package declares the bin
|
|
6
|
+
* itself and hands straight over. The import is for its effect: the CLI entry parses the
|
|
7
|
+
* arguments, runs the command, and sets the exit code as it loads.
|
|
8
|
+
*/
|
|
9
|
+
import '@picked/cli/cli';
|
|
10
|
+
//# sourceMappingURL=bin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/bin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file `picked/config` — the `picked.config` helpers, `defineConfig` included.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports `@picked/config` so a project defines its configuration without installing a
|
|
5
|
+
* second package. The names are unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export * from '@picked/config';
|
|
8
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Public exports for `picked` — the SDK front door.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the whole `@picked/client` surface, `createClient` included, so an
|
|
5
|
+
* application imports one name. `@picked/client` stays a peer dependency rather than a
|
|
6
|
+
* dependency: generated types augment `declare module '@picked/client'`, and TypeScript
|
|
7
|
+
* merges an augmentation only into the module that declares the interface. A peer is
|
|
8
|
+
* installed at the top of the consumer's tree, where that specifier resolves.
|
|
9
|
+
*/
|
|
10
|
+
export * from '@picked/client';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,gBAAgB,CAAA"}
|
|
@@ -14,8 +14,8 @@ implements the [app protocol](/reference/apps/protocol).
|
|
|
14
14
|
npm install @picked/app-kit
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
`
|
|
17
|
+
Load the package with `import` or with `require`. In TypeScript, set `moduleResolution` to
|
|
18
|
+
`node16`, `nodenext` or `bundler`.
|
|
19
19
|
|
|
20
20
|
## Entry points
|
|
21
21
|
|
|
@@ -297,7 +297,7 @@ These rules apply to lifecycle events, app events and tool calls.
|
|
|
297
297
|
|
|
298
298
|
| Rule | Value |
|
|
299
299
|
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
300
|
-
| Time to answer |
|
|
300
|
+
| Time to answer | 30 seconds for a tool call, `installation.created` and `installation.upgraded`. 15 seconds for an app event and `installation.deleted`. The time includes resends. |
|
|
301
301
|
| Resends | Only for a request with an `idempotency-key` header: app events and tool calls. Picked sends such a request three times at most, after a `408`, a `429`, a `5xx` or no answer. |
|
|
302
302
|
| Redirects | Picked does not go to a new address that a `3xx` answer gives. A `3xx` answer is not a `2xx` answer. |
|
|
303
303
|
| Answer body | Picked reads 256 KiB of the answer at most. |
|
|
@@ -11,13 +11,13 @@ have a template in a text value of its rule.
|
|
|
11
11
|
|
|
12
12
|
## Data that a template reads
|
|
13
13
|
|
|
14
|
-
| Root | Data
|
|
15
|
-
| ----------------- |
|
|
16
|
-
| `trigger` | The event or the action that started the run.
|
|
17
|
-
| `nodes.<node-id>` | The output of the last visit to a tool node. Refer to [Loops](#loops).
|
|
18
|
-
| `run` | The run. Refer to [Variables](#variables).
|
|
19
|
-
| `workflow` | The workflow. Refer to [Variables](#variables).
|
|
20
|
-
| `current` | The node that reads the data. Refer to [Variables](#variables).
|
|
14
|
+
| Root | Data | Example |
|
|
15
|
+
| ----------------- | --------------------------------------------------------------------------- | -------------------------------- |
|
|
16
|
+
| `trigger` | The event or the action that started the run. Refer to [Trigger](#trigger). | `trigger.action.responses.email` |
|
|
17
|
+
| `nodes.<node-id>` | The output of the last visit to a tool node. Refer to [Loops](#loops). | `nodes.n2.leads[0].id` |
|
|
18
|
+
| `run` | The run. Refer to [Variables](#variables). | `run.startedAt` |
|
|
19
|
+
| `workflow` | The workflow. Refer to [Variables](#variables). | `workflow.name` |
|
|
20
|
+
| `current` | The node that reads the data. Refer to [Variables](#variables). | `current.visit` |
|
|
21
21
|
|
|
22
22
|
A template writes an index as `[0]`, such as `leads[0].id`. The `var` operator of a rule
|
|
23
23
|
reads the same paths, and writes an index as a segment, such as `leads.0.id`.
|
|
@@ -26,6 +26,43 @@ In the editor, the **Insert reference** button of a field shows the data that th
|
|
|
26
26
|
read. The **Previous steps** tab shows `trigger` and `nodes`. The **Variables** tab shows
|
|
27
27
|
`run`, `workflow` and `current`.
|
|
28
28
|
|
|
29
|
+
## Trigger
|
|
30
|
+
|
|
31
|
+
All runs have these paths below `trigger`: `id`, `name`, `occurredAt`, `projectId`,
|
|
32
|
+
`workspaceId`, `entityId` and `actorId`. The trigger of the workflow adds more paths:
|
|
33
|
+
|
|
34
|
+
| Trigger | Path | Value |
|
|
35
|
+
| ------------------------------ | --------------------------------------- | ----------------------------------------------------- |
|
|
36
|
+
| An action | `trigger.action.actionKey` | The key of the action. |
|
|
37
|
+
| An action | `trigger.action.pickedId` | The Picked ID of the visitor. |
|
|
38
|
+
| An action | `trigger.action.responses.<key>` | The answer to a field that the action has. |
|
|
39
|
+
| An event | `trigger.event.name` | The name of the event, such as `workspace.published`. |
|
|
40
|
+
| `lead.created`, `lead.updated` | `trigger.lead.id` | The ID of the lead. |
|
|
41
|
+
| `lead.created`, `lead.updated` | `trigger.lead.pickedId` | The Picked ID of the visitor. |
|
|
42
|
+
| `lead.created`, `lead.updated` | `trigger.lead.workspaceVersionId` | The workspace version that captured the lead. |
|
|
43
|
+
| `lead.created`, `lead.updated` | `trigger.lead.createdAt` | The time that Picked captured the lead. |
|
|
44
|
+
| `lead.created`, `lead.updated` | `trigger.lead.responses.<key>` | The answer to a field of the workspace. |
|
|
45
|
+
| `lead.created`, `lead.updated` | `trigger.lead.labels.<namespace>.<key>` | The value of a label on the lead. |
|
|
46
|
+
|
|
47
|
+
A lead event also has `trigger.event.name`. `trigger.lead.userId` is the old name of
|
|
48
|
+
`trigger.lead.pickedId`.
|
|
49
|
+
|
|
50
|
+
Picked reads the lead when each node starts. A node reads the labels and the answers that
|
|
51
|
+
the lead has at that time, not the values at the time of the event. A node after a
|
|
52
|
+
**Set lead labels** node reads the labels that it set. In a test run with **Execute writes**
|
|
53
|
+
off, **Set lead labels** does not write. The nodes after it read the old labels.
|
|
54
|
+
|
|
55
|
+
If the lead was deleted, the node fails.
|
|
56
|
+
|
|
57
|
+
A workflow for `lead.created` or `lead.updated` reads leads, so it needs the scope
|
|
58
|
+
`ORGANIZATION_LEADS_READ`. To save the workflow, you must have this scope.
|
|
59
|
+
|
|
60
|
+
To set labels on the lead of the event, set the `lead` argument of a **Set lead labels** node
|
|
61
|
+
to `{{ trigger.lead }}`.
|
|
62
|
+
|
|
63
|
+
In a test run of a workflow for `lead.created` or `lead.updated`, you must give the ID of a
|
|
64
|
+
lead.
|
|
65
|
+
|
|
29
66
|
## Variables
|
|
30
67
|
|
|
31
68
|
| Path | Type | Value |
|
|
@@ -20,10 +20,11 @@ uses. The page names each scope that you do not have.
|
|
|
20
20
|
|
|
21
21
|
## Trigger input
|
|
22
22
|
|
|
23
|
-
| Trigger
|
|
24
|
-
|
|
|
25
|
-
| Action
|
|
26
|
-
|
|
|
23
|
+
| Trigger | Input | Meaning |
|
|
24
|
+
| -------------------------------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| Action | One input for each action field | The answer to that field. Nodes read it as `trigger.action.responses.<key>`. If a field is empty and not required, the run sends no answer for it. |
|
|
26
|
+
| Other event | **Entity ID** | The entity that the event is about. Nodes read it as `trigger.entityId`. An empty field uses the workspace. |
|
|
27
|
+
| `lead.created` or `lead.updated` event | **Lead ID** | The ID of the lead that the event is about. Nodes read the lead as `trigger.lead`. This field is required. |
|
|
27
28
|
|
|
28
29
|
Each action field gets the input for its type:
|
|
29
30
|
|
|
@@ -132,7 +132,7 @@ type Field {
|
|
|
132
132
|
helpText: String
|
|
133
133
|
"""Whether the answer is left out of analytics."""
|
|
134
134
|
doNotTrack: Boolean!
|
|
135
|
-
"""Whether the
|
|
135
|
+
"""Whether the SDK keeps the answer out of browser storage."""
|
|
136
136
|
doNotStore: Boolean!
|
|
137
137
|
"""The steps the field is on."""
|
|
138
138
|
steps: StepConnection!
|
|
@@ -232,7 +232,9 @@ input FieldCreateInput {
|
|
|
232
232
|
helpText: String
|
|
233
233
|
"""Whether the answer is left out of analytics. Defaults to `true`."""
|
|
234
234
|
doNotTrack: Boolean
|
|
235
|
-
"""
|
|
235
|
+
"""
|
|
236
|
+
Whether the SDK keeps the answer out of browser storage. Defaults to `true`.
|
|
237
|
+
"""
|
|
236
238
|
doNotStore: Boolean
|
|
237
239
|
}
|
|
238
240
|
```
|
|
@@ -288,7 +290,7 @@ input FieldUpdateInput {
|
|
|
288
290
|
helpText: String
|
|
289
291
|
"""Whether the answer is left out of analytics."""
|
|
290
292
|
doNotTrack: Boolean
|
|
291
|
-
"""Whether the
|
|
293
|
+
"""Whether the SDK keeps the answer out of browser storage."""
|
|
292
294
|
doNotStore: Boolean
|
|
293
295
|
}
|
|
294
296
|
```
|
|
@@ -118,7 +118,10 @@ An operation with `@auth` needs a caller that has authenticated. `@auth(only: US
|
|
|
118
118
|
| [`labelsDelete`](/reference/management-api/schema/label#labelsdelete) | Mutation | Deletes labels from a lead, a project or a workflow run. Deleting a label that is not set succeeds. A `LEAD` owner needs `ORGANIZATION_LEADS_UPDATE`; the other owners need `ORGANIZATION_PROJECTS_UPDATE`. Scope: `ORGANIZATION_LEADS_UPDATE` or `ORGANIZATION_PROJECTS_UPDATE`. |
|
|
119
119
|
| [`labelsSet`](/reference/management-api/schema/label#labelsset) | Mutation | Creates or replaces labels on a lead, a project or a workflow run. Labels the call does not name are unchanged. A `LEAD` owner needs `ORGANIZATION_LEADS_UPDATE`; the other owners need `ORGANIZATION_PROJECTS_UPDATE`. Scope: `ORGANIZATION_LEADS_UPDATE` or `ORGANIZATION_PROJECTS_UPDATE`. |
|
|
120
120
|
| [`lead`](/reference/management-api/schema/lead#lead) | Query | Reads a lead. Scope: `ORGANIZATION_LEADS_READ`. |
|
|
121
|
+
| [`leadCreate`](/reference/management-api/schema/lead#leadcreate) | Mutation | Creates a lead and sets its labels, then starts the workflows triggered by `lead.created`. Answers that do not match their fields return `userErrors` and nothing is written. `ORGANIZATION_LEADS_UPDATE` is required only with `labels`. Scope: `ORGANIZATION_LEADS_CREATE`, `ORGANIZATION_LEADS_READ` and `ORGANIZATION_LEADS_UPDATE`. |
|
|
121
122
|
| [`leadDelete`](/reference/management-api/schema/lead#leaddelete) | Mutation | Deletes a lead and its labels. This cannot be undone. Scope: `ORGANIZATION_LEADS_DELETE`. |
|
|
123
|
+
| [`leadUpdate`](/reference/management-api/schema/lead#leadupdate) | Mutation | Merges answers into a lead and sets its labels, then starts the workflows triggered by `lead.updated` when anything changed. A workflow on `lead.updated` that calls this mutation starts itself again unless its own conditions stop it. Scope: `ORGANIZATION_LEADS_UPDATE` and `ORGANIZATION_LEADS_READ`. |
|
|
124
|
+
| [`leadUpsert`](/reference/management-api/schema/lead#leadupsert) | Mutation | Merges answers into the newest lead of a visitor, or creates a lead when that lead is older than `sameLeadWithin`. Starts the workflows triggered by `lead.created` or `lead.updated`. Scope: `ORGANIZATION_LEADS_CREATE`, `ORGANIZATION_LEADS_UPDATE` and `ORGANIZATION_LEADS_READ`. |
|
|
122
125
|
| [`magicLinkSend`](/reference/management-api/schema/auth#magiclinksend) | Mutation | Emails an existing account a sign-in code and link. Never creates an account, and answers `success: true` for an address with no account. |
|
|
123
126
|
| [`magicLinkVerify`](/reference/management-api/schema/auth#magiclinkverify) | Mutation | Verifies the six-digit code from a sign-in or confirmation email and creates a session. |
|
|
124
127
|
| [`mcpServer`](/reference/management-api/schema/mcp-server#mcpserver) | Query | Reads an MCP server. Null when no server has the ID. Scope: `ORGANIZATION_INTEGRATIONS_READ`. |
|
|
@@ -202,7 +205,7 @@ An operation with `@auth` needs a caller that has authenticated. `@auth(only: US
|
|
|
202
205
|
| [`workbenchAssetImport`](/reference/management-api/schema/workbench#workbenchassetimport) | Mutation | Imports an asset owned elsewhere into a workbench as `IMPORTED`. The asset's owner does not change. Scope: `ORGANIZATION_WORKSPACE_UPDATE`. |
|
|
203
206
|
| [`workbenchAssetRemove`](/reference/management-api/schema/workbench#workbenchassetremove) | Mutation | Removes an asset from a workbench. Removing an `OWNED` asset also deletes it, which needs `ORGANIZATION_PROJECTS_UPDATE` and fails once a publish uses the asset. Scope: `ORGANIZATION_WORKSPACE_UPDATE`. |
|
|
204
207
|
| [`workflow`](/reference/management-api/schema/workflow#workflow) | Query | Reads a workflow. Scope: `ORGANIZATION_WORKSPACE_READ`. |
|
|
205
|
-
| [`workflowCreate`](/reference/management-api/schema/workflow#workflowcreate) | Mutation | Creates a workflow in a workspace. The caller must hold the scopes the
|
|
208
|
+
| [`workflowCreate`](/reference/management-api/schema/workflow#workflowcreate) | Mutation | Creates a workflow in a workspace. The caller must hold the scopes the workflow needs, as `Workflow.scopes` describes. Scope: `ORGANIZATION_WORKSPACE_UPDATE`. |
|
|
206
209
|
| [`workflowDelete`](/reference/management-api/schema/workflow#workflowdelete) | Mutation | Deletes a workflow. Published versions keep their copy, and an action that started it can start another workflow. Scope: `ORGANIZATION_WORKSPACE_UPDATE`. |
|
|
207
210
|
| [`workflowGraphUpdate`](/reference/management-api/schema/workflow#workflowgraphupdate) | Mutation | Updates the graph of a workflow with a change set, all or nothing. A refused change set writes nothing and comes back in `errors`. Scope: `ORGANIZATION_WORKSPACE_UPDATE`. |
|
|
208
211
|
| [`workflowRun`](/reference/management-api/schema/workflow-run#workflowrun) | Query | Reads a workflow run. Scope: `ORGANIZATION_WORKSPACE_READ`. |
|
|
@@ -21,6 +21,38 @@ lead(input: LeadInput!): Lead @auth
|
|
|
21
21
|
|
|
22
22
|
## Mutations
|
|
23
23
|
|
|
24
|
+
### `leadCreate`
|
|
25
|
+
|
|
26
|
+
Creates a lead and sets its labels, then starts the workflows triggered by `lead.created`.
|
|
27
|
+
Answers that do not match their fields return `userErrors` and nothing is written.
|
|
28
|
+
`ORGANIZATION_LEADS_UPDATE` is required only with `labels`.
|
|
29
|
+
Scope: `ORGANIZATION_LEADS_CREATE`, `ORGANIZATION_LEADS_READ` and `ORGANIZATION_LEADS_UPDATE`.
|
|
30
|
+
|
|
31
|
+
```graphql
|
|
32
|
+
leadCreate(input: LeadCreateInput!): LeadCreatePayload! @auth
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### `leadUpdate`
|
|
36
|
+
|
|
37
|
+
Merges answers into a lead and sets its labels, then starts the workflows triggered by
|
|
38
|
+
`lead.updated` when anything changed. A workflow on `lead.updated` that calls this mutation
|
|
39
|
+
starts itself again unless its own conditions stop it.
|
|
40
|
+
Scope: `ORGANIZATION_LEADS_UPDATE` and `ORGANIZATION_LEADS_READ`.
|
|
41
|
+
|
|
42
|
+
```graphql
|
|
43
|
+
leadUpdate(input: LeadUpdateInput!): LeadUpdatePayload! @auth
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### `leadUpsert`
|
|
47
|
+
|
|
48
|
+
Merges answers into the newest lead of a visitor, or creates a lead when that lead is older
|
|
49
|
+
than `sameLeadWithin`. Starts the workflows triggered by `lead.created` or `lead.updated`.
|
|
50
|
+
Scope: `ORGANIZATION_LEADS_CREATE`, `ORGANIZATION_LEADS_UPDATE` and `ORGANIZATION_LEADS_READ`.
|
|
51
|
+
|
|
52
|
+
```graphql
|
|
53
|
+
leadUpsert(input: LeadUpsertInput!): LeadUpsertPayload! @auth
|
|
54
|
+
```
|
|
55
|
+
|
|
24
56
|
### `leadDelete`
|
|
25
57
|
|
|
26
58
|
Deletes a lead and its labels. This cannot be undone.
|
|
@@ -46,22 +78,36 @@ type Lead {
|
|
|
46
78
|
projectId: ID!
|
|
47
79
|
"""
|
|
48
80
|
The Picked ID of the visitor: the ID the SDK keeps for one browser. Sentry tags and Shopify
|
|
49
|
-
order attributes carry the same value as `picked.id`.
|
|
81
|
+
order attributes carry the same value as `picked.id`. Null when the lead was written without
|
|
82
|
+
one.
|
|
50
83
|
"""
|
|
51
|
-
pickedId: String
|
|
52
|
-
"""The visitor's Picked ID."""
|
|
53
|
-
userId: String
|
|
84
|
+
pickedId: String
|
|
85
|
+
"""The visitor's Picked ID. Null when the lead was written without one."""
|
|
86
|
+
userId: String @deprecated(reason: "Use `pickedId`.")
|
|
54
87
|
"""
|
|
55
|
-
The ID of the version
|
|
88
|
+
The ID of the version whose fields the lead was last written against. Null when the lead
|
|
89
|
+
references a workspace, or no schema.
|
|
56
90
|
"""
|
|
57
91
|
workspaceVersionId: ID
|
|
58
92
|
"""
|
|
59
|
-
The version
|
|
93
|
+
The version whose fields the lead was last written against. Null when the lead references a
|
|
94
|
+
workspace, or no schema.
|
|
60
95
|
"""
|
|
61
96
|
workspaceVersion: WorkspaceVersion
|
|
62
97
|
"""
|
|
63
|
-
The
|
|
64
|
-
|
|
98
|
+
The ID of the workspace whose fields the lead was last written against. Null when the lead
|
|
99
|
+
references a version, or no schema.
|
|
100
|
+
"""
|
|
101
|
+
workspaceId: ID
|
|
102
|
+
"""
|
|
103
|
+
The workspace whose fields the lead was last written against. Null when the lead references a
|
|
104
|
+
version, or no schema, or the workspace was deleted.
|
|
105
|
+
Scope: `ORGANIZATION_WORKSPACE_READ`.
|
|
106
|
+
"""
|
|
107
|
+
workspace: Workspace @auth
|
|
108
|
+
"""
|
|
109
|
+
The answers, each with the label and type of its field in the schema the lead references. An
|
|
110
|
+
answer whose key the schema does not name has the key as its label and `TEXT` as its type.
|
|
65
111
|
"""
|
|
66
112
|
responses: [LeadResponse!]!
|
|
67
113
|
"""The labels on the lead, ordered by namespace, then key."""
|
|
@@ -78,13 +124,15 @@ type Lead {
|
|
|
78
124
|
workflowRuns(first: Int, after: String, last: Int, before: String, reverse: Boolean = true): WorkflowRunConnection! @auth
|
|
79
125
|
"""
|
|
80
126
|
Every lead with the same `pickedId`, this lead included, newest first. A visitor who passes
|
|
81
|
-
several capture points in one flow leaves a lead at each.
|
|
127
|
+
several capture points in one flow leaves a lead at each. For a lead without a `pickedId`, the
|
|
128
|
+
lead alone.
|
|
82
129
|
Scope: `ORGANIZATION_LEADS_READ`.
|
|
83
130
|
"""
|
|
84
131
|
sessionLeads(first: Int, after: String, last: Int, before: String, reverse: Boolean = true): LeadConnection! @auth
|
|
85
132
|
"""
|
|
86
|
-
The visit in which the visitor gave the lead. Null when the lead has no capture event
|
|
87
|
-
analytics holds no event for it yet or the capture happened outside
|
|
133
|
+
The visit in which the visitor gave the lead. Null when the lead has no capture event or no
|
|
134
|
+
`pickedId`, or when analytics holds no event for it yet or the capture happened outside
|
|
135
|
+
production.
|
|
88
136
|
Scope: `ORGANIZATION_SESSIONS_READ`.
|
|
89
137
|
"""
|
|
90
138
|
session: AnalyticsSession @auth
|
|
@@ -238,7 +286,7 @@ enum LeadCollapse {
|
|
|
238
286
|
NONE
|
|
239
287
|
"""
|
|
240
288
|
One lead per `pickedId`: the newest the query matches, which `matchCount` and `metrics` count once.
|
|
241
|
-
Not allowed with a `session.` clause.
|
|
289
|
+
Each lead without a `pickedId` counts on its own. Not allowed with a `session.` clause.
|
|
242
290
|
"""
|
|
243
291
|
SESSION
|
|
244
292
|
}
|
|
@@ -286,6 +334,208 @@ type LeadDeletePayload {
|
|
|
286
334
|
}
|
|
287
335
|
```
|
|
288
336
|
|
|
337
|
+
### `LeadMergePreference`
|
|
338
|
+
|
|
339
|
+
```graphql
|
|
340
|
+
"""
|
|
341
|
+
Which value a lead keeps for a response key that both the lead and the write hold.
|
|
342
|
+
"""
|
|
343
|
+
enum LeadMergePreference {
|
|
344
|
+
"""The value the write gives."""
|
|
345
|
+
NEWER
|
|
346
|
+
"""The value the lead holds, unless it is blank."""
|
|
347
|
+
OLDER
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### `LeadCreateInput`
|
|
352
|
+
|
|
353
|
+
```graphql
|
|
354
|
+
"""The input of `leadCreate`."""
|
|
355
|
+
input LeadCreateInput {
|
|
356
|
+
"""The ID of the project the lead belongs to."""
|
|
357
|
+
projectId: ID!
|
|
358
|
+
"""The Picked ID of the visitor. Omit it for a lead without one."""
|
|
359
|
+
pickedId: String
|
|
360
|
+
"""
|
|
361
|
+
The answers, as a JSON object keyed by field key. A null, an empty string, an empty list or an
|
|
362
|
+
empty object is left out.
|
|
363
|
+
"""
|
|
364
|
+
responses: JSON!
|
|
365
|
+
"""The labels to set on the lead."""
|
|
366
|
+
labels: [LabelInput!]
|
|
367
|
+
"""
|
|
368
|
+
The ID of the workspace whose current fields the answers are checked against. Omit both this
|
|
369
|
+
and `workspaceVersionId` to check against the version the project serves.
|
|
370
|
+
"""
|
|
371
|
+
workspaceId: ID
|
|
372
|
+
"""The ID of the version whose fields the answers are checked against."""
|
|
373
|
+
workspaceVersionId: ID
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### `LeadCreatePayload`
|
|
378
|
+
|
|
379
|
+
```graphql
|
|
380
|
+
"""The result of `leadCreate`."""
|
|
381
|
+
type LeadCreatePayload {
|
|
382
|
+
"""The created lead. Null when the lead was not created."""
|
|
383
|
+
lead: Lead
|
|
384
|
+
"""
|
|
385
|
+
The errors that stopped the lead being created, or a label that could not be written.
|
|
386
|
+
"""
|
|
387
|
+
userErrors: [LeadUserError!]!
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### `LeadUpdateInput`
|
|
392
|
+
|
|
393
|
+
```graphql
|
|
394
|
+
"""The input of `leadUpdate`. Omit a field to keep its value."""
|
|
395
|
+
input LeadUpdateInput {
|
|
396
|
+
"""The ID of the lead."""
|
|
397
|
+
id: ID!
|
|
398
|
+
"""
|
|
399
|
+
Which value the lead keeps for a key that both the lead and `responses` hold.
|
|
400
|
+
"""
|
|
401
|
+
prefer: LeadMergePreference!
|
|
402
|
+
"""
|
|
403
|
+
The answers to merge into the lead, as a JSON object keyed by field key. A null, an empty
|
|
404
|
+
string, an empty list or an empty object changes nothing.
|
|
405
|
+
"""
|
|
406
|
+
responses: JSON
|
|
407
|
+
"""The labels to set on the lead."""
|
|
408
|
+
labels: [LabelInput!]
|
|
409
|
+
"""
|
|
410
|
+
The ID of the workspace whose current fields the answers are checked against. Omit both this
|
|
411
|
+
and `workspaceVersionId` to check against the version the project serves.
|
|
412
|
+
"""
|
|
413
|
+
workspaceId: ID
|
|
414
|
+
"""The ID of the version whose fields the answers are checked against."""
|
|
415
|
+
workspaceVersionId: ID
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### `LeadUpdatePayload`
|
|
420
|
+
|
|
421
|
+
```graphql
|
|
422
|
+
"""The result of `leadUpdate`."""
|
|
423
|
+
type LeadUpdatePayload {
|
|
424
|
+
"""The lead. Null when the update was refused."""
|
|
425
|
+
lead: Lead
|
|
426
|
+
"""Whether the answers or the labels of the lead changed."""
|
|
427
|
+
updated: Boolean!
|
|
428
|
+
"""The response keys whose value changed, in key order."""
|
|
429
|
+
changedKeys: [String!]!
|
|
430
|
+
"""
|
|
431
|
+
The errors that stopped the update, or a label that could not be written.
|
|
432
|
+
"""
|
|
433
|
+
userErrors: [LeadUserError!]!
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### `LeadUpsertInput`
|
|
438
|
+
|
|
439
|
+
```graphql
|
|
440
|
+
"""The input of `leadUpsert`."""
|
|
441
|
+
input LeadUpsertInput {
|
|
442
|
+
"""The ID of the project the lead belongs to."""
|
|
443
|
+
projectId: ID!
|
|
444
|
+
"""The Picked ID of the visitor."""
|
|
445
|
+
pickedId: String!
|
|
446
|
+
"""
|
|
447
|
+
How recently, in seconds, the visitor's newest lead must have changed to be updated, from 1 to
|
|
448
|
+
31536000 (365 days).
|
|
449
|
+
"""
|
|
450
|
+
sameLeadWithin: Int!
|
|
451
|
+
"""
|
|
452
|
+
Which value the lead keeps for a key that both the lead and `responses` hold.
|
|
453
|
+
"""
|
|
454
|
+
prefer: LeadMergePreference!
|
|
455
|
+
"""
|
|
456
|
+
The answers, as a JSON object keyed by field key. A null, an empty string, an empty list or an
|
|
457
|
+
empty object is left out.
|
|
458
|
+
"""
|
|
459
|
+
responses: JSON
|
|
460
|
+
"""The labels to set on the lead."""
|
|
461
|
+
labels: [LabelInput!]
|
|
462
|
+
"""
|
|
463
|
+
The ID of the workspace whose current fields the answers are checked against. Omit both this
|
|
464
|
+
and `workspaceVersionId` to check against the version the project serves.
|
|
465
|
+
"""
|
|
466
|
+
workspaceId: ID
|
|
467
|
+
"""The ID of the version whose fields the answers are checked against."""
|
|
468
|
+
workspaceVersionId: ID
|
|
469
|
+
}
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### `LeadUpsertPayload`
|
|
473
|
+
|
|
474
|
+
```graphql
|
|
475
|
+
"""The result of `leadUpsert`."""
|
|
476
|
+
type LeadUpsertPayload {
|
|
477
|
+
"""The lead. Null when the upsert was refused."""
|
|
478
|
+
lead: Lead
|
|
479
|
+
"""Whether a lead was created."""
|
|
480
|
+
created: Boolean!
|
|
481
|
+
"""Whether the answers or the labels of an existing lead changed."""
|
|
482
|
+
updated: Boolean!
|
|
483
|
+
"""
|
|
484
|
+
The response keys whose value changed, in key order. Every key of a created lead.
|
|
485
|
+
"""
|
|
486
|
+
changedKeys: [String!]!
|
|
487
|
+
"""
|
|
488
|
+
The errors that stopped the upsert, or a label that could not be written.
|
|
489
|
+
"""
|
|
490
|
+
userErrors: [LeadUserError!]!
|
|
491
|
+
}
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### `LeadUserErrorCode`
|
|
495
|
+
|
|
496
|
+
```graphql
|
|
497
|
+
"""The codes of a lead write's user errors."""
|
|
498
|
+
enum LeadUserErrorCode {
|
|
499
|
+
"""No lead with that ID can be read."""
|
|
500
|
+
LEAD_NOT_FOUND
|
|
501
|
+
"""Both `workspaceId` and `workspaceVersionId` were given."""
|
|
502
|
+
WORKSPACE_REFERENCE_CONFLICT
|
|
503
|
+
"""The project has no workspace with that ID."""
|
|
504
|
+
WORKSPACE_NOT_FOUND
|
|
505
|
+
"""The project has no workspace version with that ID."""
|
|
506
|
+
WORKSPACE_VERSION_NOT_FOUND
|
|
507
|
+
"""
|
|
508
|
+
The project serves no version, and neither `workspaceId` nor `workspaceVersionId` was given.
|
|
509
|
+
"""
|
|
510
|
+
NO_LIVE_VERSION
|
|
511
|
+
"""A response key names no field."""
|
|
512
|
+
RESPONSE_KEY_UNKNOWN
|
|
513
|
+
"""
|
|
514
|
+
A response value does not match the type, list setting or options of its field.
|
|
515
|
+
"""
|
|
516
|
+
RESPONSE_VALUE_INVALID
|
|
517
|
+
"""A label cannot be written. The message says why."""
|
|
518
|
+
LABEL_INVALID
|
|
519
|
+
}
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
### `LeadUserError`
|
|
523
|
+
|
|
524
|
+
```graphql
|
|
525
|
+
"""An error in a lead write that the caller can correct."""
|
|
526
|
+
type LeadUserError {
|
|
527
|
+
"""
|
|
528
|
+
The path to the input field that caused the error, such as `["input", "responses", "email"]`.
|
|
529
|
+
Null when no single field is at fault.
|
|
530
|
+
"""
|
|
531
|
+
field: [String!]
|
|
532
|
+
"""A message that describes the error."""
|
|
533
|
+
message: String!
|
|
534
|
+
"""The error code."""
|
|
535
|
+
code: LeadUserErrorCode!
|
|
536
|
+
}
|
|
537
|
+
```
|
|
538
|
+
|
|
289
539
|
### `LeadReport`
|
|
290
540
|
|
|
291
541
|
```graphql
|
|
@@ -45,8 +45,8 @@ workflows(first: Int, after: String, last: Int, before: String, workspaceId: ID!
|
|
|
45
45
|
|
|
46
46
|
### `workflowCreate`
|
|
47
47
|
|
|
48
|
-
Creates a workflow in a workspace. The caller must hold the scopes the
|
|
49
|
-
|
|
48
|
+
Creates a workflow in a workspace. The caller must hold the scopes the workflow needs, as
|
|
49
|
+
`Workflow.scopes` describes.
|
|
50
50
|
Scope: `ORGANIZATION_WORKSPACE_UPDATE`.
|
|
51
51
|
|
|
52
52
|
```graphql
|
|
@@ -110,8 +110,9 @@ type Workflow {
|
|
|
110
110
|
"""What starts a run. Set at creation and fixed after."""
|
|
111
111
|
trigger: WorkflowTrigger!
|
|
112
112
|
"""
|
|
113
|
-
The scopes a run acts with
|
|
114
|
-
|
|
113
|
+
The scopes a run acts with: those the tools the graph names declare, and
|
|
114
|
+
`ORGANIZATION_LEADS_READ` for a `LEAD_CREATED` or `LEAD_UPDATED` trigger, which reads its lead.
|
|
115
|
+
They are set when the workflow is created, imported or its graph is saved. Saving needs each of them except `ORGANIZATION_LEADS_CREATE`, `ORGANIZATION_ACTION_RUNS_READ`,
|
|
115
116
|
`ORGANIZATION_ACTION_RUNS_UPDATE` and `ORGANIZATION_EXTERNAL_APIS_CALL`, which any author grants.
|
|
116
117
|
"""
|
|
117
118
|
scopes: [Scope!]!
|
|
@@ -617,7 +618,9 @@ tool with its shapes resolved against the fields of the workspace, and the run v
|
|
|
617
618
|
"""
|
|
618
619
|
type WorkflowReferences {
|
|
619
620
|
"""
|
|
620
|
-
The paths beneath `trigger`: `action` and its responses for an `ACTION` trigger, `event` for an
|
|
621
|
+
The paths beneath `trigger`: `action` and its responses for an `ACTION` trigger, `event` for an
|
|
622
|
+
`EVENT` trigger, and `lead` with its responses and labels beside `event` for a `LEAD_CREATED` or
|
|
623
|
+
`LEAD_UPDATED` trigger.
|
|
621
624
|
"""
|
|
622
625
|
trigger: [WorkflowReferenceEntry!]!
|
|
623
626
|
"""The paths beneath `nodes.<id>`, by the tool the node runs."""
|
|
@@ -952,7 +955,8 @@ input WorkflowTestRunInput {
|
|
|
952
955
|
responses: JSON
|
|
953
956
|
"""
|
|
954
957
|
The ID of the entity the event is about, for an `EVENT` trigger, read as `trigger.entityId`.
|
|
955
|
-
|
|
958
|
+
For `lead.created` and `lead.updated` it is the lead, read as `trigger.lead`. Defaults to the ID
|
|
959
|
+
of the workspace.
|
|
956
960
|
"""
|
|
957
961
|
entityId: ID
|
|
958
962
|
"""
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "picked",
|
|
3
3
|
"description": "The Picked SDK front door: the client, the picked.config helpers, and the picked CLI in one install",
|
|
4
|
-
"version": "0.0.117
|
|
4
|
+
"version": "0.0.117",
|
|
5
5
|
"bin": {
|
|
6
6
|
"picked": "dist/esm/bin.js"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@picked/cli": "0.0.117
|
|
10
|
-
"@picked/config": "0.0.117
|
|
9
|
+
"@picked/cli": "0.0.117",
|
|
10
|
+
"@picked/config": "0.0.117"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@picked/client": "workspace:*",
|
|
@@ -23,15 +23,25 @@
|
|
|
23
23
|
},
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
"import": {
|
|
27
|
+
"types": "./dist/types/index.d.ts",
|
|
28
|
+
"default": "./dist/esm/index.js"
|
|
29
|
+
},
|
|
30
|
+
"require": {
|
|
31
|
+
"types": "./dist/cjs/index.d.ts",
|
|
32
|
+
"default": "./dist/cjs/index.js"
|
|
33
|
+
},
|
|
29
34
|
"default": "./dist/esm/index.js"
|
|
30
35
|
},
|
|
31
36
|
"./config": {
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./dist/types/config.d.ts",
|
|
39
|
+
"default": "./dist/esm/config.js"
|
|
40
|
+
},
|
|
41
|
+
"require": {
|
|
42
|
+
"types": "./dist/cjs/config.d.ts",
|
|
43
|
+
"default": "./dist/cjs/config.js"
|
|
44
|
+
},
|
|
35
45
|
"default": "./dist/esm/config.js"
|
|
36
46
|
}
|
|
37
47
|
},
|
|
@@ -64,14 +74,14 @@
|
|
|
64
74
|
"main": "./dist/cjs/index.js",
|
|
65
75
|
"module": "./dist/esm/index.js",
|
|
66
76
|
"peerDependencies": {
|
|
67
|
-
"@picked/client": "0.0.117
|
|
77
|
+
"@picked/client": "0.0.117"
|
|
68
78
|
},
|
|
69
79
|
"private": false,
|
|
70
80
|
"publishConfig": {
|
|
71
81
|
"access": "public"
|
|
72
82
|
},
|
|
73
83
|
"scripts": {
|
|
74
|
-
"build": "vite build && tsgo -p tsconfig.build.json && node scripts/copy-docs.js",
|
|
84
|
+
"build": "vite build && tsgo -p tsconfig.build.json && node scripts/copy-docs.js && node ../../scripts/sdk-dist.mjs",
|
|
75
85
|
"check": "pnpm type-check && pnpm lint && pnpm knip && pnpm jscpd",
|
|
76
86
|
"dev": "node ../../scripts/sdk-watch-build.mjs -- node scripts/copy-docs.js",
|
|
77
87
|
"jscpd": "jscpd src",
|
|
@@ -82,7 +92,7 @@
|
|
|
82
92
|
"lint:report": "eslint . -o './.reports/eslint.json' -f json || true",
|
|
83
93
|
"test": "vitest run",
|
|
84
94
|
"test:coverage": "../../scripts/vitest-coverage.sh",
|
|
85
|
-
"test:packaged-types": "attw --pack",
|
|
95
|
+
"test:packaged-types": "attw --pack --profile node16",
|
|
86
96
|
"test:watch": "vitest",
|
|
87
97
|
"type-check": "tsgo -p . --noEmit"
|
|
88
98
|
},
|