@sess.si/sdk 0.4.0 → 0.6.0
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/CHANGELOG.md +23 -0
- package/README.md +19 -16
- package/dist/ask.d.ts +5 -5
- package/dist/ask.js +6 -6
- package/dist/client.js +1 -0
- package/dist/commerce/builders.d.ts +2 -2
- package/dist/commerce/builders.js +4 -4
- package/dist/commerce/items.d.ts +3 -3
- package/dist/commerce/items.js +2 -2
- package/dist/errors.d.ts +1 -1
- package/dist/generated/openapi.d.ts +6692 -2673
- package/dist/internal/decode.js +21 -0
- package/dist/internal/version.d.ts +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/receipts/closing.d.ts +82 -0
- package/dist/receipts/closing.js +237 -0
- package/dist/receipts/index.d.ts +3 -1
- package/dist/receipts/index.js +1 -0
- package/dist/receipts/resource.d.ts +22 -1
- package/dist/receipts/resource.js +91 -0
- package/dist/receipts/verify.d.ts +4 -0
- package/dist/receipts/verify.js +3 -3
- package/dist/types.d.ts +22 -14
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -33,8 +33,16 @@ export type InteractiveSurfaceRevision = Schemas['InteractiveSurfaceResponse'];
|
|
|
33
33
|
export type SurfaceRevision = DisplaySurfaceRevision | InteractiveSurfaceRevision;
|
|
34
34
|
/** One Event of `GET /v1/sessions/{id}/events`; `revision_envelope` on `response.accepted` only. */
|
|
35
35
|
export type SessionEvent = GeneratedSessionEvents['events'][number] & RevisionEnvelopeMember;
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The Session's closing receipt (`closing` on `GET /v1/sessions/{id}/events`): beside the Events,
|
|
38
|
+
* never one of them and never a round's `receipt`. Present only once the Session has ended with at
|
|
39
|
+
* least one accepted answer and the Events carry exactly the rounds it signs. Verify it with
|
|
40
|
+
* `receipts.verifyClosing()` or `verifyClosingReceipt`, never as a receipt for one answer.
|
|
41
|
+
*/
|
|
42
|
+
export type SessionClosing = Schemas['SessionClosing'];
|
|
43
|
+
export type SessionEvents = Omit<GeneratedSessionEvents, 'events' | 'closing'> & {
|
|
37
44
|
events: SessionEvent[];
|
|
45
|
+
closing?: SessionClosing;
|
|
38
46
|
};
|
|
39
47
|
/**
|
|
40
48
|
* The Sess link's state at the time of a Session read (Decision 0009 Amendment 10): `live` takes
|
|
@@ -112,7 +120,7 @@ export interface ItemsComponent {
|
|
|
112
120
|
name?: string;
|
|
113
121
|
/** 1–100 rows, in order. */
|
|
114
122
|
rows: {
|
|
115
|
-
/** What one line is: at most
|
|
123
|
+
/** What one line is: at most 30. Example: `Design retainer, October` */
|
|
116
124
|
name: string;
|
|
117
125
|
/** Optional second line: quantity, unit price or a reference; at most 160. Example: `3 × $150.00` */
|
|
118
126
|
detail?: string;
|
|
@@ -140,7 +148,7 @@ export interface ItemsComponent {
|
|
|
140
148
|
* `length` (on `SessError`) name the value and the most it may have.
|
|
141
149
|
*/
|
|
142
150
|
export type SurfaceComponent = (Component<'heading'> & {
|
|
143
|
-
/** A section heading: a few words; at most
|
|
151
|
+
/** A section heading: a few words; at most 40. Example: `Order details` */
|
|
144
152
|
text: string;
|
|
145
153
|
}) | (Component<'text'> & {
|
|
146
154
|
/**
|
|
@@ -152,21 +160,21 @@ export type SurfaceComponent = (Component<'heading'> & {
|
|
|
152
160
|
/** Optional caption above the record: a few words; at most 200. Example: `Order 1042` */
|
|
153
161
|
label?: string;
|
|
154
162
|
/**
|
|
155
|
-
* Rows shown verbatim, 1–50. A row's name: a word or two; at most
|
|
163
|
+
* Rows shown verbatim, 1–50. A row's name: a word or two; at most 24 (example `Amount`).
|
|
156
164
|
* A row's value: a string of at most 200, or a number, boolean or null (example `$120.00`).
|
|
157
165
|
*/
|
|
158
166
|
fields: {
|
|
159
167
|
[key: string]: string | number | boolean | null;
|
|
160
168
|
};
|
|
161
169
|
}) | (Omit<Component<'field'>, 'schema'> & {
|
|
162
|
-
/** What the field asks for: short, a few words; at most
|
|
170
|
+
/** What the field asks for: short, a few words; at most 40. Example: `Refund amount` */
|
|
163
171
|
label: string;
|
|
164
172
|
/**
|
|
165
|
-
* Optional help under the label: one hint; at most
|
|
173
|
+
* Optional help under the label: one hint; at most 120.
|
|
166
174
|
* Example: `Leave it as is to refund the full amount.`
|
|
167
175
|
*/
|
|
168
176
|
description?: string;
|
|
169
|
-
/** The words shown for one choice: short; at most
|
|
177
|
+
/** The words shown for one choice: short; at most 30. Example: `Next Monday` */
|
|
170
178
|
option_labels?: {
|
|
171
179
|
[key: string]: string;
|
|
172
180
|
};
|
|
@@ -182,24 +190,24 @@ export type SurfaceComponent = (Component<'heading'> & {
|
|
|
182
190
|
schema: FieldSchema;
|
|
183
191
|
}) | ItemsComponent;
|
|
184
192
|
type DocumentedAction = RawPublishSessionRequest['interaction']['actions'][number] & {
|
|
185
|
-
/** A button: a verb, 1–3 words; at most
|
|
193
|
+
/** A button: a verb, 1–3 words; at most 16. Examples: `Approve`, `Send refund` */
|
|
186
194
|
label: string;
|
|
187
195
|
};
|
|
188
196
|
/**
|
|
189
197
|
* An interactive Surface: a title, plain-text components and typed fields, and 1–5 actions.
|
|
190
|
-
* Limits in Unicode code points: title
|
|
191
|
-
* caption 200, row name
|
|
192
|
-
*
|
|
198
|
+
* Limits in Unicode code points: title 60, description 200, heading 40, text 4000, record
|
|
199
|
+
* caption 200, row name 24, row string value 200, field label 40, field help 120, option label
|
|
200
|
+
* 30, button 16; at most 5 actions.
|
|
193
201
|
*/
|
|
194
202
|
export type InteractiveInteraction = Omit<RawPublishSessionRequest['interaction'], 'source' | 'actions'> & {
|
|
195
203
|
/**
|
|
196
|
-
* The page's heading: a question or a task, about 40 characters; at most
|
|
204
|
+
* The page's heading: a question or a task, about 40 characters; at most 60.
|
|
197
205
|
* Examples: `Approve the refund?`, `Pick a delivery date`
|
|
198
206
|
*/
|
|
199
207
|
title: string;
|
|
200
208
|
/**
|
|
201
209
|
* Optional context under the title: what the person decides and why, in one or two plain
|
|
202
|
-
* sentences; at most
|
|
210
|
+
* sentences; at most 200. Example: `The customer was charged twice for order 1042.`
|
|
203
211
|
*/
|
|
204
212
|
description?: string;
|
|
205
213
|
/**
|
|
@@ -211,7 +219,7 @@ export type InteractiveInteraction = Omit<RawPublishSessionRequest['interaction'
|
|
|
211
219
|
kind: 'sess_surface';
|
|
212
220
|
components: SurfaceComponent[];
|
|
213
221
|
};
|
|
214
|
-
/** The buttons, 1–5. A button: a verb, 1–3 words; at most
|
|
222
|
+
/** The buttons, 1–5. A button: a verb, 1–3 words; at most 16. */
|
|
215
223
|
actions: DocumentedAction[];
|
|
216
224
|
};
|
|
217
225
|
export type CreateSessionRequest = {
|
package/package.json
CHANGED