@sess.si/sdk 0.4.0 → 0.5.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 +5 -0
- package/README.md +18 -16
- package/dist/ask.d.ts +5 -5
- package/dist/ask.js +6 -6
- 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 +6388 -2539
- package/dist/internal/version.d.ts +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/types.d.ts +13 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.0 — 2026-11-21
|
|
4
|
+
|
|
5
|
+
- Sess's tighter text limits: title 60, description 200, heading 40, field label 40, field help
|
|
6
|
+
120, option label 30, record key 24, button 16, items row name 30; every other limit is unchanged.
|
|
7
|
+
|
|
3
8
|
## 0.4.0 — 2026-11-18
|
|
4
9
|
|
|
5
10
|
- Receipt v2 reads the frozen revision envelope, `sess_revision: 2`, and only it: ten common
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ terminal with a verified receipt.
|
|
|
14
14
|
**Install** the SDK in your own server project:
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
|
-
npm install --save-exact @sess.si/sdk@0.
|
|
17
|
+
npm install --save-exact @sess.si/sdk@0.5.0
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Ask a person
|
|
@@ -86,21 +86,22 @@ characters (Unicode code points), and Sess never truncates:
|
|
|
86
86
|
|
|
87
87
|
| What | Style | At most |
|
|
88
88
|
| --------------------------- | ------------------------------ | -------- |
|
|
89
|
-
| Title (`question`) | A question or a task, about 40 |
|
|
90
|
-
| Button (`submit_label`) | A verb, 1–3 words |
|
|
91
|
-
| Field label
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
89
|
+
| Title (`question`) | A question or a task, about 40 | 60 |
|
|
90
|
+
| Button (`submit_label`) | A verb, 1–3 words | 16 |
|
|
91
|
+
| Field label | Short | 40 |
|
|
92
|
+
| Option | Short | 30 |
|
|
93
|
+
| Help (field `description`) | One hint | 120 |
|
|
94
|
+
| Description under the title | One or two sentences | 200 |
|
|
95
|
+
| Heading | Short | 40 |
|
|
95
96
|
| Record caption | A few words | 200 |
|
|
96
|
-
| Record key / string value | As written |
|
|
97
|
+
| Record key / string value | As written | 24 / 200 |
|
|
97
98
|
| Text (`details`) | Plain text | 4,000 |
|
|
98
99
|
|
|
99
100
|
There are at most 5 buttons. A value over its limit fails with a `SessError` that names it:
|
|
100
101
|
`field` is a JSON pointer such as `/question`, `limit` is the most it may have and `length` is
|
|
101
|
-
what it has. The message says how to fix it: "The title can be at most
|
|
102
|
+
what it has. The message says how to fix it: "The title can be at most 60 characters. Keep it
|
|
102
103
|
to a short heading, about 40." for the title, and for anything else, for example
|
|
103
|
-
"/fields/0/label is
|
|
104
|
+
"/fields/0/label is 52 characters; the limit is 40. Shorten it to at most 40 characters." Nothing
|
|
104
105
|
was created (`outcome` is `not_sent` or `rejected`), so shorten the value and ask again:
|
|
105
106
|
|
|
106
107
|
```ts
|
|
@@ -120,9 +121,10 @@ async function askShort(question: string) {
|
|
|
120
121
|
}
|
|
121
122
|
```
|
|
122
123
|
|
|
123
|
-
**Release status:** `0.
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
**Release status:** `0.5.0` is the current release, served under the `latest` dist-tag. It
|
|
125
|
+
checks Sess's tighter text limits before anything is sent, verifies receipt v2 in its frozen format,
|
|
126
|
+
still verifies receipt v1, and accepts a Sess Ask's webhook messages. A receipt newer than this
|
|
127
|
+
release is reported as newer, never as a failed check.
|
|
126
128
|
`next` stays at the last release candidate, `0.1.0-rc.10`. The [changelog](CHANGELOG.md) describes each version; `npm view @sess.si/sdk dist-tags` shows what the registry serves now.
|
|
127
129
|
|
|
128
130
|
## Commerce
|
|
@@ -146,7 +148,7 @@ console.log(`Send this Sess link to the person: ${created.data.human_url}`);
|
|
|
146
148
|
|
|
147
149
|
Three things you will meet first:
|
|
148
150
|
|
|
149
|
-
- **Short rows.** A row name has at most
|
|
151
|
+
- **Short rows.** A row name has at most 30 characters and its detail at most 160. A longer value
|
|
150
152
|
is refused, never trimmed: the `SessError` names it by its pointer, such as
|
|
151
153
|
`/interaction/source/components/1/rows/0/name`, with `limit` and `length`.
|
|
152
154
|
- **Whole minor units.** Amounts are integers in the currency's smallest unit: cents for USD, yen
|
|
@@ -243,10 +245,10 @@ exact Surface and input, and the issuer's public keys. Check it on your own comp
|
|
|
243
245
|
trust (never the keys inside the bundle):
|
|
244
246
|
|
|
245
247
|
```sh
|
|
246
|
-
npx -p @sess.si/sdk@0.
|
|
248
|
+
npx -p @sess.si/sdk@0.5.0 sess verify bundle.json --issuer https://api.sess.si --keys sess-receipt-keys.json
|
|
247
249
|
```
|
|
248
250
|
|
|
249
|
-
The `sess` command first ships in `0.1.0-rc.5`; any later version, `0.
|
|
251
|
+
The `sess` command first ships in `0.1.0-rc.5`; any later version, `0.5.0` included, has it.
|
|
250
252
|
|
|
251
253
|
You'll see `Valid decision bundle.` and what was accepted, when, on which revision; or `Invalid`
|
|
252
254
|
and the first reason; or `This bundle is newer than @sess.si/sdk {version}. Update @sess.si/sdk to
|
package/dist/ask.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { ApiResult, AskCounts, AskRespondentRecord, CreateAskRequest, Creat
|
|
|
5
5
|
interface AskFieldBase {
|
|
6
6
|
/** Key of this field in the answer: `^[a-z][a-z0-9_]{0,63}$`. */
|
|
7
7
|
readonly name: string;
|
|
8
|
-
/** What the field asks for: short, a few words; at most
|
|
8
|
+
/** What the field asks for: short, a few words; at most 40. Example: `Refund amount` */
|
|
9
9
|
readonly label: string;
|
|
10
10
|
/** Default `true`, except boolean fields (default `false`). */
|
|
11
11
|
readonly required?: boolean;
|
|
@@ -42,12 +42,12 @@ export type AskField = (AskFieldBase & {
|
|
|
42
42
|
readonly default?: number;
|
|
43
43
|
}) | (AskFieldBase & {
|
|
44
44
|
readonly type: 'choice';
|
|
45
|
-
/** 1–100 choices. The words shown for one choice: short; at most
|
|
45
|
+
/** 1–100 choices. The words shown for one choice: short; at most 30. Example: `Next Monday` */
|
|
46
46
|
readonly options: readonly [string, ...string[]];
|
|
47
47
|
readonly default?: string;
|
|
48
48
|
}) | (AskFieldBase & {
|
|
49
49
|
readonly type: 'multi_choice';
|
|
50
|
-
/** 1–100 choices. The words shown for one choice: short; at most
|
|
50
|
+
/** 1–100 choices. The words shown for one choice: short; at most 30. Example: `Next Monday` */
|
|
51
51
|
readonly options: readonly [string, ...string[]];
|
|
52
52
|
readonly default?: readonly string[];
|
|
53
53
|
});
|
|
@@ -58,13 +58,13 @@ export type AskField = (AskFieldBase & {
|
|
|
58
58
|
*/
|
|
59
59
|
export interface AskInput<F extends readonly AskField[] = readonly AskField[]> {
|
|
60
60
|
/**
|
|
61
|
-
* The page's heading: a question or a task, about 40 characters; at most
|
|
61
|
+
* The page's heading: a question or a task, about 40 characters; at most 60.
|
|
62
62
|
* Examples: `Approve the refund?`, `Pick a delivery date`
|
|
63
63
|
*/
|
|
64
64
|
readonly question: string;
|
|
65
65
|
/** Optional plain-text context shown above the fields, at most 4,000 characters. */
|
|
66
66
|
readonly details?: string;
|
|
67
|
-
/** A button: a verb, 1–3 words; at most
|
|
67
|
+
/** A button: a verb, 1–3 words; at most 16. Default `Send`. Examples: `Approve`, `Send refund` */
|
|
68
68
|
readonly submit_label?: string;
|
|
69
69
|
/** One to twelve fields with unique names. */
|
|
70
70
|
readonly fields: F;
|
package/dist/ask.js
CHANGED
|
@@ -9,19 +9,19 @@ import { withSignal } from './internal/time.js';
|
|
|
9
9
|
const SURFACE_LIMIT_BYTES = 131_072;
|
|
10
10
|
/**
|
|
11
11
|
* Sess's limits, in Unicode code points (the runtime checks the same numbers; nothing is ever
|
|
12
|
-
* truncated): the question (title)
|
|
13
|
-
* field labels
|
|
12
|
+
* truncated): the question (title) 60, details (a text component) 4,000, the submit button 16,
|
|
13
|
+
* field labels 40, options 30.
|
|
14
14
|
*/
|
|
15
15
|
const LIMITS = Object.freeze({
|
|
16
16
|
fields: 12,
|
|
17
17
|
options: 100,
|
|
18
18
|
depth: 8,
|
|
19
19
|
textMax: 4000,
|
|
20
|
-
question:
|
|
20
|
+
question: 60,
|
|
21
21
|
details: 4000,
|
|
22
|
-
submitLabel:
|
|
23
|
-
label:
|
|
24
|
-
option:
|
|
22
|
+
submitLabel: 16,
|
|
23
|
+
label: 40,
|
|
24
|
+
option: 30,
|
|
25
25
|
/** A rating's end label (`low`, `high`). */
|
|
26
26
|
ratingLabel: 24,
|
|
27
27
|
});
|
|
@@ -4,9 +4,9 @@ type Action = InteractiveInteraction['actions'][number];
|
|
|
4
4
|
type RecordValue = string | number | boolean | null;
|
|
5
5
|
/** Common input of the five builders: the items input plus the page around it. */
|
|
6
6
|
export interface BillInput extends ItemsInput {
|
|
7
|
-
/** The page's heading, about 40 characters; at most
|
|
7
|
+
/** The page's heading, about 40 characters; at most 60. Each builder has a default. */
|
|
8
8
|
readonly title?: string;
|
|
9
|
-
/** Optional context under the title, one or two sentences; at most
|
|
9
|
+
/** Optional context under the title, one or two sentences; at most 200. */
|
|
10
10
|
readonly description?: string;
|
|
11
11
|
/** Advanced: the BCP 47 locale the page formats amounts in (default: the page's language). */
|
|
12
12
|
readonly locale?: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { buildItems, refuse, text, token, tooLong } from './items.js';
|
|
2
2
|
import { lintText } from './lint.js';
|
|
3
3
|
const LIMITS = Object.freeze({
|
|
4
|
-
title:
|
|
5
|
-
description:
|
|
6
|
-
recordKey:
|
|
4
|
+
title: 60,
|
|
5
|
+
description: 200,
|
|
6
|
+
recordKey: 24,
|
|
7
7
|
recordValue: 200,
|
|
8
8
|
recordFields: 50,
|
|
9
9
|
actions: 5,
|
|
10
|
-
actionLabel:
|
|
10
|
+
actionLabel: 16,
|
|
11
11
|
});
|
|
12
12
|
const ACTION_ID = /^[a-z][a-z0-9_]{0,31}$/;
|
|
13
13
|
const INTENTS = ['submit', 'continue', 'approve', 'reject', 'request_change'];
|
package/dist/commerce/items.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ItemsComponent } from '../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* The runtime's items limits (Unicode code points for text): rows 1–100, totals lines ≤ 8, a row
|
|
4
|
-
* name ≤
|
|
4
|
+
* name ≤ 30, a detail ≤ 160, a totals label ≤ 40, a caption ≤ 200, a quantity unit ≤ 16, every
|
|
5
5
|
* amount within ±10^15 minor units, a quantity within 0–1,000,000.
|
|
6
6
|
*/
|
|
7
7
|
export declare const ITEMS_LIMITS: Readonly<{
|
|
8
8
|
rows: 100;
|
|
9
9
|
totals: 8;
|
|
10
|
-
name:
|
|
10
|
+
name: 30;
|
|
11
11
|
detail: 160;
|
|
12
12
|
totalLabel: 40;
|
|
13
13
|
label: 200;
|
|
@@ -24,7 +24,7 @@ export interface Money {
|
|
|
24
24
|
export type Amount = number | Money;
|
|
25
25
|
/** A line of the bill. Put quantity and unit price in `detail`, not in `name`. */
|
|
26
26
|
export interface ItemRowInput {
|
|
27
|
-
/** What the line is, shown verbatim; at most
|
|
27
|
+
/** What the line is, shown verbatim; at most 30. Example: `Design retainer, October` */
|
|
28
28
|
readonly name: string;
|
|
29
29
|
/** Optional second line: quantity or unit price; at most 160 with `reference`. Example: `3 × $150.00` */
|
|
30
30
|
readonly detail?: string;
|
package/dist/commerce/items.js
CHANGED
|
@@ -7,13 +7,13 @@ import { SessError, lengthMessage } from '../errors.js';
|
|
|
7
7
|
import { minorUnits } from './currency.js';
|
|
8
8
|
/**
|
|
9
9
|
* The runtime's items limits (Unicode code points for text): rows 1–100, totals lines ≤ 8, a row
|
|
10
|
-
* name ≤
|
|
10
|
+
* name ≤ 30, a detail ≤ 160, a totals label ≤ 40, a caption ≤ 200, a quantity unit ≤ 16, every
|
|
11
11
|
* amount within ±10^15 minor units, a quantity within 0–1,000,000.
|
|
12
12
|
*/
|
|
13
13
|
export const ITEMS_LIMITS = Object.freeze({
|
|
14
14
|
rows: 100,
|
|
15
15
|
totals: 8,
|
|
16
|
-
name:
|
|
16
|
+
name: 30,
|
|
17
17
|
detail: 160,
|
|
18
18
|
totalLabel: 40,
|
|
19
19
|
label: 200,
|
package/dist/errors.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export declare class SessError extends Error {
|
|
|
50
50
|
* the value to at most `limit` characters and send again.
|
|
51
51
|
*/
|
|
52
52
|
readonly field?: string;
|
|
53
|
-
/** With `field`: the most the value may have, in Unicode code points (e.g. title
|
|
53
|
+
/** With `field`: the most the value may have, in Unicode code points (e.g. title 60). */
|
|
54
54
|
readonly limit?: number;
|
|
55
55
|
/** With `field`: the value's actual length, in Unicode code points. */
|
|
56
56
|
readonly length?: number;
|