@spoketech/hub-client 0.1.24 → 0.1.26

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
@@ -313,6 +313,7 @@ All routes below are relative to `/api/v1`. The promise client and the Effect cl
313
313
  | `client.memberSources.getOrganizationMemberSourceCsvUploadReadiness({ params })` | `GET /organizations/:organizationId/member-source/csv-upload-readiness` | `params.organizationId` | `CsvUploadReadiness` |
314
314
  | `client.memberSources.getOrganizationMemberSourceCsvMapping({ params })` | `GET /organizations/:organizationId/member-source/csv-mapping` | `params.organizationId` | `OrganizationMemberSourceCsvMapping \| null` |
315
315
  | `client.memberSources.upsertOrganizationMemberSourceCsvMapping({ params, payload })` | `PUT /organizations/:organizationId/member-source/csv-mapping` | `params.organizationId`, `UpsertOrganizationMemberSourceCsvMappingInput` | `OrganizationMemberSourceCsvMapping` |
316
+ | `client.memberSources.createOrganizationInitialMembershipUpload({ params, payload })` | `POST /organizations/:organizationId/initial-membership-uploads` | `params.organizationId`, `{ fileName: "members.xlsx" }` | `CreateOrganizationInitialMembershipUploadResponse` |
316
317
  | `client.memberSources.createOrganizationMemberSourceCsvUpload({ params, payload })` | `POST /organizations/:organizationId/member-source/csv-uploads` | `params.organizationId`, `CreateOrganizationMemberSourceCsvUploadInput` | `CreateOrganizationMemberSourceCsvUploadResponse` |
317
318
  | `client.memberSources.listOrganizationMemberSyncRuns({ params, query })` | `GET /organizations/:organizationId/member-source/runs` | `params.organizationId`, optional `page`, `pageSize` | `PaginatedOrganizationMemberSyncRuns` |
318
319
  | `client.memberSources.listOrganizationMemberSourceCommands({ params, query })` | `GET /organizations/:organizationId/member-source/commands` | `params.organizationId`, optional `page`, `pageSize` | `PaginatedOrganizationMemberSourceCommands` |
@@ -426,3 +427,81 @@ const [member, error] = await client.members.getByExternalSystemId({
426
427
  ```
427
428
 
428
429
  This lookup excludes deleted members, returns a 404 when no member matches, and returns a 409 conflict if multiple members match. The database enforces external system ID uniqueness within each organization; the conflict check guards against a missing constraint.
430
+
431
+ ### Initial membership export upload
432
+
433
+ Use `POST /api/v1/organizations/:organizationId/initial-membership-uploads` with
434
+ `{ "fileName": "members.xlsx" }` to stage a CSV, XLS, or XLSX export for later mapping
435
+ and review. Requires `members:write` access to the organization; no member source
436
+ or saved mapping is needed. The convenience SDK method is
437
+ `spoke.memberSources.initialMembershipUploads.create({ organizationId, payload })`.
438
+
439
+ The response contains `uploadId`, `bucketName`, `objectKey`, `fileName`, `contentType`,
440
+ `expiresIn` (7200 seconds), and `presignedPost`. Submit all returned POST fields,
441
+ then the file, to the returned URL:
442
+
443
+ ```ts
444
+ const form = new FormData();
445
+ for (const [key, value] of Object.entries(upload.presignedPost.fields)) {
446
+ form.append(key, value);
447
+ }
448
+ form.append("file", file);
449
+ const response = await fetch(upload.presignedPost.url, { method: "POST", body: form });
450
+ if (!response.ok) throw new Error("Membership export upload failed");
451
+ ```
452
+
453
+ Files must be between 1 byte and 100 MiB. The original file is stored in the existing
454
+ member imports bucket at `initial-membership-uploads/{organizationId}/{uploadId}/{fileName}`
455
+ (with the filename sanitized for storage). Keep the returned upload identifier and
456
+ object key for subsequent review work. Creating the upload target records an audit
457
+ event; successful storage is confirmed by the S3 POST response. This endpoint does
458
+ not parse the file, create an import session, or start a member sync run. Mapping and review APIs are separate follow-up work.
459
+
460
+
461
+ Check stored exports with `GET /api/v1/organizations/:organizationId/initial-membership-uploads`
462
+ (`members:read`), or `spoke.memberSources.initialMembershipUploads.get({ organizationId })`.
463
+ It returns `{ hasUpload, uploads }`; each file includes `uploadId`, `fileName`, `objectKey`,
464
+ `sizeBytes`, and `uploadedAt`. Unused upload targets do not count as stored files.
465
+
466
+ Delete a selected export with
467
+ `DELETE /api/v1/organizations/:organizationId/initial-membership-uploads/:uploadId`
468
+ (`members:write`), or `spoke.memberSources.initialMembershipUploads.delete({ organizationId, uploadId })`.
469
+ The result is `{ uploadId, deleted }`; `deleted` is false when no file exists in that
470
+ organization for the ID. Deletions are audited. An existing presigned POST remains valid
471
+ until its two-hour expiry and can upload the file again after deletion.
472
+
473
+ Deploy the SST permission changes before using these routes: listing and deletion
474
+ permissions are limited to the initial membership upload prefix in the existing bucket.
475
+
476
+
477
+ The organization sidebar's **Initial uploads** page lists stored files with their
478
+ size and upload date. Readers can download files; organization and platform admins
479
+ can remove files after confirming the selected filename.
480
+
481
+ `GET /api/v1/organizations/:organizationId/initial-membership-uploads/:uploadId/download`
482
+ requires `members:read` and returns `{ url, expiresIn: 300 }`. The URL downloads the
483
+ original file as an attachment and expires after five minutes. Missing files return
484
+ 404. The SDK method is
485
+ `spoke.memberSources.initialMembershipUploads.download({ organizationId, uploadId })`.
486
+ The SST policy also grants `s3:GetObject` for the initial upload prefix.
487
+
488
+ ### Retryable automatic points awards (0.1.26)
489
+
490
+ `posPoints.requestAdd` accepts optional `idempotencyKey` and
491
+ `payload.expectedProviderId`. Retry with the exact original terms to retrieve the
492
+ same command/current status; changed terms return 409. Omit the key for legacy
493
+ behavior. `posPoints.getProvider` adds optional typed `readiness`, including
494
+ concrete configured accounts/default, amount limits, caller access, durable
495
+ request deduplication and recent onsite execution/recovery support. Older Hub
496
+ responses may omit readiness and must not enable automatic awards.
497
+
498
+ Submission still requires `vouchers:write`; provider reads and
499
+ `pointProviders.getOrganizationPointCommand` require `vouchers:read`, with access
500
+ to the target organization. Stored payloads now preserve a supplied Hub
501
+ `memberId`; historical records may omit it. Before accepting completion, verify
502
+ the organization, provider ID, kind, Member, amount and concrete account, and
503
+ require `status === "completed"` with `executionEvidence.outcome === "confirmed"`.
504
+ An `accepted` command with `uncertain` evidence requires reconciliation, never
505
+ another automatic award. Deploy Hub safety protocol 1 and a capable onsite agent
506
+ before enabling keyed awards. See the repository's
507
+ `docs/points-addition-rollout.md` for provider validation and rollout requirements.