@spoketech/hub-client 0.5.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/README.md CHANGED
@@ -95,6 +95,42 @@ if (activation.settled && activation.command.result) {
95
95
  console.log(activation.command.result.outcome);
96
96
  }
97
97
 
98
+ // Member create requests check Hub and the venue before creating anyone.
99
+ const [creation, creationError] = await client.members.requestCreation({
100
+ organizationId: "org_123",
101
+ payload: {
102
+ idempotencyKey: "application-123-attempt-1",
103
+ waitMs: 10_000,
104
+ // Omit, or send false, until the applicant has authorized renewal at this rate.
105
+ allowRenewalOnDuplicate: false,
106
+ member: {
107
+ firstName: "Jane",
108
+ lastName: "Smith",
109
+ dob: "1988-06-14",
110
+ membershipTypeId: "12",
111
+ },
112
+ },
113
+ });
114
+
115
+ if (creationError !== null) {
116
+ throw creationError;
117
+ }
118
+
119
+ switch (creation.settled ? creation.command.result?.outcome : undefined) {
120
+ case "created":
121
+ case "matched_active":
122
+ case "renewed_existing":
123
+ console.log(creation.command.result);
124
+ break;
125
+ case "renewal_required":
126
+ // Nothing was changed. Ask for renewal authorization, then submit again with
127
+ // allowRenewalOnDuplicate: true and a new idempotency key.
128
+ break;
129
+ default:
130
+ // Pending, review, or failure: keep the application open and follow the command.
131
+ break;
132
+ }
133
+
98
134
  const [guests, guestsError] = await client.guests.list({
99
135
  organizationId: "org_123",
100
136
  name: "Jane",
@@ -299,6 +335,7 @@ All routes below are relative to `/api/v1`. The promise client and the Effect cl
299
335
  | `client.members.listOrganizationMemberMembershipTypes({ params, query })` | `GET /organizations/:organizationId/members/membership-types` | `params.organizationId`, optional `page`, `pageSize` | `PaginatedOrganizationMemberMembershipTypes` |
300
336
  | `client.members.listOrganizationMemberRatingGrades({ params, query })` | `GET /organizations/:organizationId/members/rating-grades` | `params.organizationId`, optional `page`, `pageSize` | `PaginatedOrganizationMemberRatingGrades` |
301
337
  | `client.members.createOrganizationMember({ params, payload })` | `POST /organizations/:organizationId/members` | `params.organizationId`, `CreateMemberInput` for local-member creation | `Member` |
338
+ | `client.members.requestMemberCreation({ params, payload })` | `POST /organizations/:organizationId/members/create-requests` | `params.organizationId`, `RequestMemberCreationInput` | `EnsureActiveMembershipResponse` |
302
339
  | `client.members.ensureActiveMembership({ params, payload })` | `POST /organizations/:organizationId/members/ensure-active` | `params.organizationId`, `RequestEnsureActiveMembershipInput` | `EnsureActiveMembershipResponse` |
303
340
  | `client.members.requestSourceManagedMemberCreate({ params, payload })` | `POST /organizations/:organizationId/members/source-create` | `params.organizationId`, `RequestSourceManagedMemberCreateInput` for Odyssey/onsite source creation | `OrganizationMemberSourceCommand` |
304
341
  | `client.members.requestSourceManagedMemberRenewal({ params, payload })` | `POST /organizations/:organizationId/members/:memberId/source-renewal` | `params.organizationId`, `params.memberId`, `RequestSourceManagedMemberRenewalInput` for Odyssey/onsite source renewal | `OrganizationMemberSourceCommand` |
@@ -468,9 +505,12 @@ The raw client exposes `client.organizations.getOrganizationCapabilities({ param
468
505
  `client.organizations.get({ organizationId })` returns the organization itself, and
469
506
  `client.members.summary({ organizationId })` returns member counts by status.
470
507
  The response contains `organizationId`, `points`, `vouchers`, `onsiteMemberLookup`,
471
- and `memberCreation`. Each capability has `supported`, `enabled`, and a nullable
508
+ `memberCreation`, and `memberCreateRequests`. Each capability has `supported`, `enabled`, and a nullable
472
509
  machine-readable `reason`. Member creation also has `mode`: `local` for Hub member
473
510
  creation, or `source_managed` for Odyssey Ensure Active Membership.
511
+ `memberCreateRequests` is enabled once the venue's Odyssey onsite agent advertises the
512
+ version 2 contract (`agent_upgrade_required` until then). Other venues report it as unsupported
513
+ and keep using their existing create path.
474
514
 
475
515
  `points` describes live provider points operations, and `vouchers` describes
476
516
  provider voucher issuing. `supported` means the configured integration supports
@@ -624,6 +664,31 @@ requested permissions as part of profile preparation before renewal. Demo creati
624
664
  supports the same object. Nexus creation and the permission update remain separate
625
665
  calls, not an atomic operation.
626
666
 
667
+ ## Member create requests (0.6.0)
668
+
669
+ `client.members.requestCreation` submits `POST /organizations/:organizationId/members/create-requests`.
670
+ Hub checks its own members and then the venue system before anything is created, so a person who is
671
+ already a member is never duplicated. The response has the same shape as Ensure Active Membership:
672
+ `settled`, `timedOut`, and an `ensure_active_membership` command whose `result.outcome` is one of:
673
+
674
+ | Outcome | Meaning |
675
+ | --- | --- |
676
+ | `created` | A new member was created. Use `result.memberId`. |
677
+ | `matched_active` | A verified existing member is current. Their rate and profile are unchanged; use the returned `membershipTypeId` and `membershipExpiry`. |
678
+ | `renewed_existing` | An expired existing member was renewed because `allowRenewalOnDuplicate` was `true`. |
679
+ | `renewal_required` | A verified existing member has expired. Nothing was changed. `memberId`, `membershipTypeId`, and the past `membershipExpiry` are included. |
680
+ | `ambiguous_identity_match`, `unsupported_source_status`, `indeterminate_membership_expiry`, `manual_review_required`, `failed` | Keep the application open; the venue must resolve the member. |
681
+
682
+ - `allowRenewalOnDuplicate` defaults to `false`. Send `true` only once renewal at the requested rate
683
+ has been authorized for this attempt, with a new `idempotencyKey`.
684
+ - The idempotency comparison covers the whole request, including the flag and `membershipTypeId`.
685
+ Replaying the same request returns the same command; changing it under the same key returns `409`.
686
+ - A pending command keeps its ID. Follow it with
687
+ `client.memberSources.commands.get({ organizationId, commandId })` or the signed member-source
688
+ command webhook; both report the same outcome.
689
+ - The route is available where `memberCreateRequests.enabled` is `true` in the organization
690
+ capabilities. Requests to a venue whose onsite agent has not been upgraded return `409`.
691
+
627
692
  ## Display-only offer catalogue (0.2.0)
628
693
 
629
694
  Use `client.offers.catalogue.list({ organizationId })` or