@sess.si/sdk 0.3.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 +42 -0
- package/README.md +21 -18
- package/dist/ask.d.ts +5 -5
- package/dist/ask.js +6 -6
- package/dist/cli/verify.d.ts +6 -2
- package/dist/cli/verify.js +12 -5
- 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 +8 -2
- 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/receipts/bundle.d.ts +15 -9
- package/dist/receipts/bundle.js +21 -4
- package/dist/receipts/envelope.d.ts +60 -15
- package/dist/receipts/envelope.js +150 -45
- package/dist/receipts/index.d.ts +1 -1
- package/dist/receipts/json.d.ts +13 -0
- package/dist/receipts/json.js +21 -0
- package/dist/receipts/shared-title.d.ts +7 -0
- package/dist/receipts/shared-title.js +127 -0
- package/dist/receipts/verify.d.ts +6 -1
- package/dist/receipts/verify.js +29 -4
- package/dist/types.d.ts +17 -16
- package/dist/webhooks/index.d.ts +17 -1
- package/dist/webhooks/index.js +20 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
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
|
+
|
|
8
|
+
## 0.4.0 — 2026-11-18
|
|
9
|
+
|
|
10
|
+
- Receipt v2 reads the frozen revision envelope, `sess_revision: 2`, and only it: ten common
|
|
11
|
+
members (`sess_revision`, `revision`, `session_id`, `surface_hash`, `renderer_version`,
|
|
12
|
+
`published_at`, `key_id`, `grant_id`, `agent_target`, `ask_id`), then exactly one of `titles`
|
|
13
|
+
(`nonce`, `grant_title`, `target_title`, `owner_name`) or `titles_digest`. `revision_hash` is
|
|
14
|
+
the digest of the compact form, so both forms of one round verify the same. Each title is one
|
|
15
|
+
line of plain text, 1 to 60 code points, under the shared title rule (no bidirectional,
|
|
16
|
+
zero-width or invisible characters). There is no `key_label`. Both forms, neither, any other
|
|
17
|
+
member, and the nine-member `sess_revision: 1` envelope that 0.3.0 read (never issued) are
|
|
18
|
+
refused with `REVISION_ENVELOPE_MISMATCH`. A receipt v2 `action.label` over 24 code points is
|
|
19
|
+
`INVALID_CLAIMS`. 0.3.x cannot read an issued receipt v2; update to this version.
|
|
20
|
+
- A receipt newer than this release, a later Sess receipt type or an envelope of a later
|
|
21
|
+
`sess_revision`, is reported as newer, never as a verification failure, and nothing is
|
|
22
|
+
returned: `verifyDecisionReceipt`, `receipts.verifyResponse()`, and `sess.ask()`'s `answer()`
|
|
23
|
+
and `read()`, throw a `SessError` of the new kind `receipt_newer` with code `RECEIPT_NEWER`;
|
|
24
|
+
`verifyDecisionBundle` returns `unsupported_version`; `sess verify` says the bundle is newer and
|
|
25
|
+
exits with the new status 3.
|
|
26
|
+
- `verifyDecisionBundle` refuses a bundle-v2 whose envelope is the compact form (a QR code's, never
|
|
27
|
+
a file's) with `revision`. A valid result's `revision_envelope` is the full form.
|
|
28
|
+
- New types `RevisionEnvelopeFull`, `RevisionEnvelopeCompact`, `EnvelopeTitles` and
|
|
29
|
+
`EnvelopeAgentTarget`; `RevisionEnvelope` is now the union of the two forms. The receipt-v2 and
|
|
30
|
+
bundle-v2 specifications and the bundle-v2 conformance corpus are copies from Sess commit
|
|
31
|
+
`33cfc41`.
|
|
32
|
+
- Fix: `verifyWebhook` refused the webhook messages Sess sends for a Sess Ask, with
|
|
33
|
+
`WEBHOOK_INVALID_PAYLOAD`. It now accepts them:
|
|
34
|
+
- `response.accepted` for one respondent to an Ask carries `ask_id` (`ask_…`) beside
|
|
35
|
+
`session_id`. The member is checked as an Ask ID and returned as `WebhookEvent.ask_id`. Any
|
|
36
|
+
other Session's message is unchanged and has no `ask_id`.
|
|
37
|
+
- `ask.closed` is its own message: exactly `type`, `event_id`, `ask_id`, `closed_by` (`max` or
|
|
38
|
+
`owner`), `started` and `closed_at`, each checked, its `event_id` equal to the `webhook-id`
|
|
39
|
+
header. It is returned as the new exported type `AskClosed`; `VerifiedWebhook` is now the
|
|
40
|
+
union of `WebhookEvent`, `AskClosed` and `WebhookChallenge`. Code that narrows on `type` and
|
|
41
|
+
treats every message that is not a challenge as `response.accepted` should check for
|
|
42
|
+
`ask.closed` too.
|
|
43
|
+
- The runtime dependencies are unchanged. The default `User-Agent` names the new version.
|
|
44
|
+
|
|
3
45
|
## 0.3.0 — 2026-11-08
|
|
4
46
|
|
|
5
47
|
- Receipt v2: `verifyDecisionReceipt` and `receipts.verifyResponse()` verify receipts of type
|
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,10 +121,11 @@ async function askShort(question: string) {
|
|
|
120
121
|
}
|
|
121
122
|
```
|
|
122
123
|
|
|
123
|
-
**Release status:** `0.
|
|
124
|
-
|
|
125
|
-
receipt v1
|
|
126
|
-
|
|
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.
|
|
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
|
|
129
131
|
|
|
@@ -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,13 +245,14 @@ 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
|
-
and the first reason
|
|
254
|
+
and the first reason; or `This bundle is newer than @sess.si/sdk {version}. Update @sess.si/sdk to
|
|
255
|
+
check it.` when the bundle is newer than your version can check. Exit status is 0 valid, 1 invalid, 2 usage error, 3 newer; add `--json` for the full
|
|
253
256
|
result. Nothing is sent anywhere. In code, use `verifyDecisionBundle` from `@sess.si/sdk/receipts`
|
|
254
257
|
([Security](docs/security.md#decision-bundles)). Formats: [receipt-v1](docs/spec/receipt-v1.md) and
|
|
255
258
|
[bundle-v1](docs/spec/bundle-v1.md).
|
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
|
});
|
package/dist/cli/verify.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Exit codes: valid, invalid bundle, usage or file error, and a bundle newer than this release
|
|
3
|
+
* checks (a later bundle version, receipt type or revision envelope: reported, never a failure).
|
|
4
|
+
*/
|
|
2
5
|
export declare const EXIT: Readonly<{
|
|
3
6
|
valid: 0;
|
|
4
7
|
invalid: 1;
|
|
5
8
|
usage: 2;
|
|
9
|
+
newer: 3;
|
|
6
10
|
}>;
|
|
7
11
|
export interface CliIo {
|
|
8
12
|
stdout: (text: string) => void;
|
|
9
13
|
stderr: (text: string) => void;
|
|
10
14
|
}
|
|
11
|
-
export declare const USAGE = "Usage: sess verify <bundle.json> --issuer <url> --keys <jwks.json> [options]\n\nChecks a Sess decision bundle on this computer against the issuer and keys you trust.\nNothing is sent anywhere. Keys inside the bundle are never trusted.\n\nRequired:\n --issuer <url> the receipt issuer you trust, for example https://api.sess.si\n --keys <file> that issuer's public keys (a JWK Set) you obtained yourself\n\nExpected context (optional; only what you pass is checked):\n --audience <id> the workspace the decision must belong to\n --workspace <id> the workspace ID\n --session <id> the Session ID\n --event <id> the Event ID\n --revision <n> the Surface revision\n --action <id> the action ID\n\nRenderer identity (optional):\n --renderers <file> the issuer's signed renderer list you obtained yourself\n (<issuer>/.well-known/sess-renderer-identities.json); also checks that the\n receipt's renderer identity is one this release knows or one on that list\n\nOther:\n --now <time> check at this RFC 3339 time instead of now\n --json print the full result as JSON\n -h, --help show this help\n\nExit status: 0 valid, 1 invalid, 2 usage or file error.\n";
|
|
15
|
+
export declare const USAGE = "Usage: sess verify <bundle.json> --issuer <url> --keys <jwks.json> [options]\n\nChecks a Sess decision bundle on this computer against the issuer and keys you trust.\nNothing is sent anywhere. Keys inside the bundle are never trusted.\n\nRequired:\n --issuer <url> the receipt issuer you trust, for example https://api.sess.si\n --keys <file> that issuer's public keys (a JWK Set) you obtained yourself\n\nExpected context (optional; only what you pass is checked):\n --audience <id> the workspace the decision must belong to\n --workspace <id> the workspace ID\n --session <id> the Session ID\n --event <id> the Event ID\n --revision <n> the Surface revision\n --action <id> the action ID\n\nRenderer identity (optional):\n --renderers <file> the issuer's signed renderer list you obtained yourself\n (<issuer>/.well-known/sess-renderer-identities.json); also checks that the\n receipt's renderer identity is one this release knows or one on that list\n\nOther:\n --now <time> check at this RFC 3339 time instead of now\n --json print the full result as JSON\n -h, --help show this help\n\nExit status: 0 valid, 1 invalid, 2 usage or file error, 3 newer than this version checks.\n";
|
|
12
16
|
/** Runs `sess <argv>`; resolves to the exit code. Never throws. */
|
|
13
17
|
export declare function runCli(argv: readonly string[], io: CliIo): Promise<number>;
|
package/dist/cli/verify.js
CHANGED
|
@@ -5,10 +5,14 @@
|
|
|
5
5
|
import { readFile, stat } from 'node:fs/promises';
|
|
6
6
|
import { parseArgs } from 'node:util';
|
|
7
7
|
import { verifyDecisionBundle, } from '../receipts/bundle.js';
|
|
8
|
+
import { SDK_VERSION } from '../internal/version.js';
|
|
8
9
|
import { BUNDLED_RENDERER_IDENTITIES } from '../receipts/renderers.js';
|
|
9
10
|
import { validateKeySet, verifyRendererIdentities } from '../receipts/verify.js';
|
|
10
|
-
/**
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Exit codes: valid, invalid bundle, usage or file error, and a bundle newer than this release
|
|
13
|
+
* checks (a later bundle version, receipt type or revision envelope: reported, never a failure).
|
|
14
|
+
*/
|
|
15
|
+
export const EXIT = Object.freeze({ valid: 0, invalid: 1, usage: 2, newer: 3 });
|
|
12
16
|
/** A bundle file larger than this is not read (the bundle bound itself is 1 MiB canonical). */
|
|
13
17
|
const MAX_BUNDLE_FILE_BYTES = 16 * 1024 * 1024;
|
|
14
18
|
const MAX_KEYS_FILE_BYTES = 1024 * 1024;
|
|
@@ -40,7 +44,7 @@ Other:
|
|
|
40
44
|
--json print the full result as JSON
|
|
41
45
|
-h, --help show this help
|
|
42
46
|
|
|
43
|
-
Exit status: 0 valid, 1 invalid, 2 usage or file error.
|
|
47
|
+
Exit status: 0 valid, 1 invalid, 2 usage or file error, 3 newer than this version checks.
|
|
44
48
|
`;
|
|
45
49
|
class UsageError extends Error {
|
|
46
50
|
}
|
|
@@ -184,7 +188,6 @@ function parse(argv) {
|
|
|
184
188
|
const REASON_TEXT = {
|
|
185
189
|
malformed: 'the file is not a decision bundle (bundle-v1 or bundle-v2)',
|
|
186
190
|
oversized: 'the bundle exceeds a decision bundle size bound',
|
|
187
|
-
unsupported_version: 'the bundle uses a later format version',
|
|
188
191
|
receipt_malformed: 'the receipt cannot be read',
|
|
189
192
|
algorithm: 'the receipt does not use the EdDSA algorithm',
|
|
190
193
|
missing_kid: 'the receipt names no key',
|
|
@@ -226,6 +229,10 @@ function summary(r, renderer) {
|
|
|
226
229
|
if (renderer)
|
|
227
230
|
row('Renderer', `${safe(c.surface.renderer_version)} (listed)`);
|
|
228
231
|
}
|
|
232
|
+
else if (r.reason === 'unsupported_version') {
|
|
233
|
+
// A later bundle version, receipt type or revision envelope: newer, never a damaged file.
|
|
234
|
+
lines.push(`This bundle is newer than @sess.si/sdk ${SDK_VERSION}. Update @sess.si/sdk to check it.`);
|
|
235
|
+
}
|
|
229
236
|
else {
|
|
230
237
|
lines.push(`Invalid decision bundle: ${r.reason}`);
|
|
231
238
|
lines.push(` ${REASON_TEXT[r.reason ?? ''] ?? ''}`);
|
|
@@ -313,7 +320,7 @@ export async function runCli(argv, io) {
|
|
|
313
320
|
result = { ...result, valid: false, reason: 'renderer' };
|
|
314
321
|
}
|
|
315
322
|
io.stdout(parsed.json ? safeJson(renderer ? { ...result, renderer } : result) : summary(result, renderer));
|
|
316
|
-
return result.valid ? EXIT.valid : EXIT.invalid;
|
|
323
|
+
return result.valid ? EXIT.valid : result.reason === 'unsupported_version' ? EXIT.newer : EXIT.invalid;
|
|
317
324
|
}
|
|
318
325
|
catch (e) {
|
|
319
326
|
const message = e instanceof UsageError ? e.message : 'unexpected error';
|
|
@@ -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
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { inspect } from 'node:util';
|
|
2
2
|
import type { CreateSessionResponse } from './types.js';
|
|
3
|
-
export type SessErrorKind = 'configuration' | 'api' | 'transport' | 'timeout' | 'aborted' | 'protocol' | 'unknown_outcome' | 'receipt_verification'
|
|
3
|
+
export type SessErrorKind = 'configuration' | 'api' | 'transport' | 'timeout' | 'aborted' | 'protocol' | 'unknown_outcome' | 'receipt_verification'
|
|
4
|
+
/**
|
|
5
|
+
* The receipt is newer than this release can check (code `RECEIPT_NEWER`): a later receipt type
|
|
6
|
+
* or a later revision envelope. Nothing was verified and no answer data is returned. It is not a
|
|
7
|
+
* verification failure: update @sess.si/sdk to check it.
|
|
8
|
+
*/
|
|
9
|
+
| 'receipt_newer' | 'wait_ended';
|
|
4
10
|
export type WriteOutcome = 'not_sent' | 'rejected' | 'unknown';
|
|
5
11
|
export interface SessErrorDetails {
|
|
6
12
|
code?: string;
|
|
@@ -44,7 +50,7 @@ export declare class SessError extends Error {
|
|
|
44
50
|
* the value to at most `limit` characters and send again.
|
|
45
51
|
*/
|
|
46
52
|
readonly field?: string;
|
|
47
|
-
/** 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). */
|
|
48
54
|
readonly limit?: number;
|
|
49
55
|
/** With `field`: the value's actual length, in Unicode code points. */
|
|
50
56
|
readonly length?: number;
|