@spoketech/hub-client 0.1.24 → 0.1.25
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 +58 -0
- package/dist/index.d.ts +1262 -143
- package/dist/index.js +131 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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,60 @@ 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.
|