@orangecheck/me-client 0.61.0 → 0.62.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 CHANGED
@@ -10,6 +10,48 @@ this file tracks the package's TS / Node / runtime API surface.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.62.0] — 2026-11-12
14
+
15
+ ### Added
16
+
17
+ - `PaymentResult` carries `mode`, `settles` and `is_stub`, as me.ochk.io
18
+ answers them: `'stub'`, `false`, `true`. Its `sats_charged` is the amount
19
+ the intent names; nothing is charged.
20
+ - `FireEventResult` has the answer me.ochk.io gives an event it recorded and
21
+ charged nothing: `earned: false`, `reason: 'not_billed'`, `detail` and the
22
+ `event`. It paid nobody. Code that reads `next_pay_period` after
23
+ `!res.earned` now checks `res.reason === 'not_paying'` first.
24
+ - `FireEventResult` carries `webhooks_queued` and the event's `drop` window.
25
+ - A `recorded` entry of `BatchEventResult` carries the event's `drop` window
26
+ too, as me.ochk.io sends it for a batch.
27
+
28
+ ### Changed
29
+
30
+ - `oc.event.fire`'s `earned` follows whether the event was charged. In
31
+ preview it is a preview answer, as `escrow_mode: 'simulation'` says.
32
+ `escrow_mode` is optional, as on a replay me.ochk.io leaves it out, and
33
+ `webhooks_fired` is deprecated for `webhooks_queued`: both count webhooks
34
+ queued, not delivered.
35
+ - `payment.authorize` and the README say what the call does today: it records
36
+ a payment intent in the signed-in person's name and settles nothing. No sats
37
+ move, nobody is charged, and the person earns nothing from it. There is no
38
+ prompt and no `'cancelled'` answer; a refusal throws `MeClientError`.
39
+ - The README's payment price words: when the event is priced as a percent of
40
+ the payment, the percent is in (0, 1] and the event needs
41
+ `payment_amount_sats`. The person earns about 80% of the price: the fee is
42
+ 20% of the price, rounded to a whole sat and at least 1 sat.
43
+ - `IntegratorPriceConfig` and the templates say a config is changed on
44
+ ochk.app, which saves it with `POST /api/me/projects/<project_key>`; this
45
+ SDK only builds and checks one. The template example ends with
46
+ `oc.config.validate` and saving on ochk.app, and names the marketplace
47
+ template's payment price, 0.609375%.
48
+ - `config.validate` and `validateIntegratorConfig` say what they check (the
49
+ shape, and each enabled event's own price limits; an agent block's shape
50
+ only) and that me.ochk.io checks more when it saves, among them the domain,
51
+ labels, the operator's price bounds and a price that earns nothing.
52
+ - The pay period comments: a period that has started keeps its start; its end
53
+ can still move, but never to before now.
54
+
13
55
  ## [0.61.0] — 2026-11-12
14
56
 
15
57
  ### Added
package/README.md CHANGED
@@ -128,11 +128,13 @@ const res = await oc.event.fire({
128
128
  signingSecret: process.env.OC_SIGNING_SECRET,
129
129
  accountId: didOc,
130
130
  });
131
- if (!res.earned) {
132
- // res.reason === 'not_paying'; res.next_pay_period says when paying starts, if scheduled
131
+ if (!res.earned && res.reason === 'not_paying') {
132
+ // no event recorded; res.next_pay_period says when paying starts, if scheduled
133
133
  }
134
134
  ```
135
135
 
136
+ An event recorded and charged nothing answers `earned: false, reason: 'not_billed'` with its `event`: a test project's event while orangecheck is live, or one in preview from a project with no preview credit yet. It paid nobody.
137
+
136
138
  `fireBatch` answers `not_paying` per event. `GET /api/integrator/config` publishes the project's `pay_periods`, past ones included, and `payingAt(periods, date)` tells you whether a project pays at a moment. Pass them to `oc.event.verify(envelope, config, amount, { payPeriods })` to flag a receipt billed outside every period.
137
139
 
138
140
  ## Session lifecycle
@@ -171,7 +173,11 @@ await oc.session.invalidate(session.id);
171
173
 
172
174
  ## Payment authorization
173
175
 
174
- Class B billable event. Sub-Stripe rates (0.5–1.0% percentage-based). The person earns the share you set per event (`user_share_pct`, 0 to 0.8 of the gross fee; OC keeps 20%, and the default templates give 0.8), and it lands in their balance at ochk.app.
176
+ Records a payment intent in the signed-in person's name. It settles nothing yet: the answer carries `mode: 'stub'`, `settles: false` and `is_stub: true`. No sats move, your balance is not charged, and the person earns nothing from it.
177
+
178
+ There is no prompt; the person is whoever is signed in. `description` (at most 280 characters) stays private, and the rest of the record is signed and readable at `verify_url`. An account records at most 20 a UTC day on each site. A refusal throws `MeClientError`.
179
+
180
+ To bill for a payment, fire the `payment_authorization` event with `oc.event.fire`. When it is priced as a percent of the payment, the percent is in (0, 1] and the event needs `payment_amount_sats`. The person earns about 80% of the price: the fee is 20% of the price, rounded to a whole sat and at least 1 sat.
175
181
 
176
182
  ```ts
177
183
  import { oc } from '@orangecheck/me-client';
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { v as verifyActivityAttestation, r as refreshEnvelopeJwks } from './identity-DfxCvxuH.mjs';
2
2
  export { A as ActivityAttestation, a as ActivityAttestationBundle, b as ActivityVerifyCheck, c as ActivityVerifyResult, V as VerifyActivityOptions, i as identity } from './identity-DfxCvxuH.mjs';
3
- import { S as Scope, B as BillableEvent, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, a as SignInOptions, b as Session, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation, G as GrantedOptions, d as GrantedResult, r as request, p as parseTrustAttestationCount } from './integrator-fTchEeNJ.mjs';
4
- export { e as ALL_EVENT_SUBTYPES, h as ARCHETYPE_TEMPLATES, i as AgentClassOverride, j as AttestTier, C as CUSTOM_EVENT_KEY_RE, k as ClassASubtype, l as ClassBSubtype, m as ClassCSubtype, n as ComputedFees, D as DropCadence, o as DropClosedWebhookPayload, q as DropResponseBlock, s as DropScheduleSummary, t as EVENT_SUBTYPES, u as EventClass, v as EventSubtype, w as EventSubtypeMetadata, x as FederationMigratingWebhookPayload, y as FederationMigrationCancelledWebhookPayload, z as FederationStatus, H as FederationSuccessor, J as IntegratorArchetype, K as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, L as MIN_INTEGRATOR_PRICE_SATS, N as PLATFORM_FEE_POLICY, R as RequestOptions, O as SCOPE_IDS, Q as SessionPolicy, U as SigningMethod, W as SiteFeeShape, X as SystemWebhookPayload, Y as TrustAttestationCount, Z as WebhookHeaders, _ as WebhookPayload, $ as computeFees, a0 as isEventClass, a1 as isInheritedName, a2 as scope, a3 as subtypesForClass, a4 as validateIntegratorConfig } from './integrator-fTchEeNJ.mjs';
3
+ import { S as Scope, B as BillableEvent, D as DropResponseBlock, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, a as SignInOptions, b as Session, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation, G as GrantedOptions, d as GrantedResult, r as request, p as parseTrustAttestationCount } from './integrator-BiJgTlse.mjs';
4
+ export { e as ALL_EVENT_SUBTYPES, h as ARCHETYPE_TEMPLATES, i as AgentClassOverride, j as AttestTier, C as CUSTOM_EVENT_KEY_RE, k as ClassASubtype, l as ClassBSubtype, m as ClassCSubtype, n as ComputedFees, o as DropCadence, q as DropClosedWebhookPayload, s as DropScheduleSummary, t as EVENT_SUBTYPES, u as EventClass, v as EventSubtype, w as EventSubtypeMetadata, x as FederationMigratingWebhookPayload, y as FederationMigrationCancelledWebhookPayload, z as FederationStatus, H as FederationSuccessor, J as IntegratorArchetype, K as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, L as MIN_INTEGRATOR_PRICE_SATS, N as PLATFORM_FEE_POLICY, R as RequestOptions, O as SCOPE_IDS, Q as SessionPolicy, U as SigningMethod, W as SiteFeeShape, X as SystemWebhookPayload, Y as TrustAttestationCount, Z as WebhookHeaders, _ as WebhookPayload, $ as computeFees, a0 as isEventClass, a1 as isInheritedName, a2 as scope, a3 as subtypesForClass, a4 as validateIntegratorConfig } from './integrator-BiJgTlse.mjs';
5
5
  export { CONNECT_CONSENT_BLURB, CONNECT_CONSENT_LABEL } from './connect-consent.mjs';
6
6
 
7
7
  type FamilyVerb = 'oc-vote' | 'oc-stamp' | 'oc-agent' | 'oc-attest' | 'oc-lock' | 'oc-pledge';
@@ -82,8 +82,22 @@ type FireEventResult = {
82
82
  ok: true;
83
83
  earned: true;
84
84
  event: BillableEvent;
85
+ webhooks_queued: number;
85
86
  webhooks_fired: number;
86
- escrow_mode: 'simulation' | 'live';
87
+ escrow_mode?: 'simulation' | 'live';
88
+ drop?: DropResponseBlock;
89
+ idempotent_replay?: boolean;
90
+ simulation_mode_note?: string;
91
+ } | {
92
+ ok: true;
93
+ earned: false;
94
+ reason: 'not_billed';
95
+ detail: string;
96
+ event: BillableEvent;
97
+ webhooks_queued: number;
98
+ webhooks_fired: number;
99
+ escrow_mode?: 'simulation' | 'live';
100
+ drop?: DropResponseBlock;
87
101
  idempotent_replay?: boolean;
88
102
  simulation_mode_note?: string;
89
103
  } | {
@@ -107,6 +121,7 @@ type BatchEventResult = {
107
121
  index: number;
108
122
  status: 'recorded';
109
123
  event: BillableEvent;
124
+ drop?: DropResponseBlock;
110
125
  } | {
111
126
  index: number;
112
127
  status: 'duplicate';
@@ -262,4 +277,4 @@ declare const oc: {
262
277
  };
263
278
  };
264
279
 
265
- export { ArchetypeTemplate, type BatchEventResult, type BatchRejectCode, BillableEvent, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, GrantedOptions, GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, Scope, Session, SignInOptions, TelemetryEvent, ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payingAt, payment, refreshEnvelopeJwks, safeReturnPath, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
280
+ export { ArchetypeTemplate, type BatchEventResult, type BatchRejectCode, BillableEvent, DropResponseBlock, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, GrantedOptions, GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, Scope, Session, SignInOptions, TelemetryEvent, ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payingAt, payment, refreshEnvelopeJwks, safeReturnPath, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { v as verifyActivityAttestation, r as refreshEnvelopeJwks } from './identity-DfxCvxuH.js';
2
2
  export { A as ActivityAttestation, a as ActivityAttestationBundle, b as ActivityVerifyCheck, c as ActivityVerifyResult, V as VerifyActivityOptions, i as identity } from './identity-DfxCvxuH.js';
3
- import { S as Scope, B as BillableEvent, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, a as SignInOptions, b as Session, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation, G as GrantedOptions, d as GrantedResult, r as request, p as parseTrustAttestationCount } from './integrator-fTchEeNJ.js';
4
- export { e as ALL_EVENT_SUBTYPES, h as ARCHETYPE_TEMPLATES, i as AgentClassOverride, j as AttestTier, C as CUSTOM_EVENT_KEY_RE, k as ClassASubtype, l as ClassBSubtype, m as ClassCSubtype, n as ComputedFees, D as DropCadence, o as DropClosedWebhookPayload, q as DropResponseBlock, s as DropScheduleSummary, t as EVENT_SUBTYPES, u as EventClass, v as EventSubtype, w as EventSubtypeMetadata, x as FederationMigratingWebhookPayload, y as FederationMigrationCancelledWebhookPayload, z as FederationStatus, H as FederationSuccessor, J as IntegratorArchetype, K as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, L as MIN_INTEGRATOR_PRICE_SATS, N as PLATFORM_FEE_POLICY, R as RequestOptions, O as SCOPE_IDS, Q as SessionPolicy, U as SigningMethod, W as SiteFeeShape, X as SystemWebhookPayload, Y as TrustAttestationCount, Z as WebhookHeaders, _ as WebhookPayload, $ as computeFees, a0 as isEventClass, a1 as isInheritedName, a2 as scope, a3 as subtypesForClass, a4 as validateIntegratorConfig } from './integrator-fTchEeNJ.js';
3
+ import { S as Scope, B as BillableEvent, D as DropResponseBlock, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, a as SignInOptions, b as Session, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation, G as GrantedOptions, d as GrantedResult, r as request, p as parseTrustAttestationCount } from './integrator-BiJgTlse.js';
4
+ export { e as ALL_EVENT_SUBTYPES, h as ARCHETYPE_TEMPLATES, i as AgentClassOverride, j as AttestTier, C as CUSTOM_EVENT_KEY_RE, k as ClassASubtype, l as ClassBSubtype, m as ClassCSubtype, n as ComputedFees, o as DropCadence, q as DropClosedWebhookPayload, s as DropScheduleSummary, t as EVENT_SUBTYPES, u as EventClass, v as EventSubtype, w as EventSubtypeMetadata, x as FederationMigratingWebhookPayload, y as FederationMigrationCancelledWebhookPayload, z as FederationStatus, H as FederationSuccessor, J as IntegratorArchetype, K as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, L as MIN_INTEGRATOR_PRICE_SATS, N as PLATFORM_FEE_POLICY, R as RequestOptions, O as SCOPE_IDS, Q as SessionPolicy, U as SigningMethod, W as SiteFeeShape, X as SystemWebhookPayload, Y as TrustAttestationCount, Z as WebhookHeaders, _ as WebhookPayload, $ as computeFees, a0 as isEventClass, a1 as isInheritedName, a2 as scope, a3 as subtypesForClass, a4 as validateIntegratorConfig } from './integrator-BiJgTlse.js';
5
5
  export { CONNECT_CONSENT_BLURB, CONNECT_CONSENT_LABEL } from './connect-consent.js';
6
6
 
7
7
  type FamilyVerb = 'oc-vote' | 'oc-stamp' | 'oc-agent' | 'oc-attest' | 'oc-lock' | 'oc-pledge';
@@ -82,8 +82,22 @@ type FireEventResult = {
82
82
  ok: true;
83
83
  earned: true;
84
84
  event: BillableEvent;
85
+ webhooks_queued: number;
85
86
  webhooks_fired: number;
86
- escrow_mode: 'simulation' | 'live';
87
+ escrow_mode?: 'simulation' | 'live';
88
+ drop?: DropResponseBlock;
89
+ idempotent_replay?: boolean;
90
+ simulation_mode_note?: string;
91
+ } | {
92
+ ok: true;
93
+ earned: false;
94
+ reason: 'not_billed';
95
+ detail: string;
96
+ event: BillableEvent;
97
+ webhooks_queued: number;
98
+ webhooks_fired: number;
99
+ escrow_mode?: 'simulation' | 'live';
100
+ drop?: DropResponseBlock;
87
101
  idempotent_replay?: boolean;
88
102
  simulation_mode_note?: string;
89
103
  } | {
@@ -107,6 +121,7 @@ type BatchEventResult = {
107
121
  index: number;
108
122
  status: 'recorded';
109
123
  event: BillableEvent;
124
+ drop?: DropResponseBlock;
110
125
  } | {
111
126
  index: number;
112
127
  status: 'duplicate';
@@ -262,4 +277,4 @@ declare const oc: {
262
277
  };
263
278
  };
264
279
 
265
- export { ArchetypeTemplate, type BatchEventResult, type BatchRejectCode, BillableEvent, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, GrantedOptions, GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, Scope, Session, SignInOptions, TelemetryEvent, ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payingAt, payment, refreshEnvelopeJwks, safeReturnPath, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
280
+ export { ArchetypeTemplate, type BatchEventResult, type BatchRejectCode, BillableEvent, DropResponseBlock, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, GrantedOptions, GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, Scope, Session, SignInOptions, TelemetryEvent, ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payingAt, payment, refreshEnvelopeJwks, safeReturnPath, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };