@spoketech/hub-client 0.1.23 → 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 +70 -0
- package/dist/index.d.ts +1928 -3
- package/dist/index.js +156 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -293,6 +293,7 @@ All routes below are relative to `/api/v1`. The promise client and the Effect cl
|
|
|
293
293
|
| --- | --- | --- | --- |
|
|
294
294
|
| `client.members.listOrganizationMembers({ params, query })` | `GET /organizations/:organizationId/members` | `params.organizationId`, optional paging and search `query` | `OrganizationMembersListResponse` |
|
|
295
295
|
| `client.members.getOrganizationMember({ params, query })` | `GET /organizations/:organizationId/members/:memberId` | `params.organizationId`, `params.memberId`, optional `responseMode` | `MemberResponse` |
|
|
296
|
+
| `client.members.getOrganizationMemberByExternalSystemId({ params, query })` | `GET /organizations/:organizationId/members/by-external-system-id/:externalSystemMemberId` | `params.organizationId`, `params.externalSystemMemberId`, optional `responseMode` | One `MemberResponse`; 404 when missing |
|
|
296
297
|
| `client.members.listOrganizationMemberMembershipTypes({ params, query })` | `GET /organizations/:organizationId/members/membership-types` | `params.organizationId`, optional `page`, `pageSize` | `PaginatedOrganizationMemberMembershipTypes` |
|
|
297
298
|
| `client.members.listOrganizationMemberRatingGrades({ params, query })` | `GET /organizations/:organizationId/members/rating-grades` | `params.organizationId`, optional `page`, `pageSize` | `PaginatedOrganizationMemberRatingGrades` |
|
|
298
299
|
| `client.members.createOrganizationMember({ params, payload })` | `POST /organizations/:organizationId/members` | `params.organizationId`, `CreateMemberInput` for local-member creation | `Member` |
|
|
@@ -312,6 +313,7 @@ All routes below are relative to `/api/v1`. The promise client and the Effect cl
|
|
|
312
313
|
| `client.memberSources.getOrganizationMemberSourceCsvUploadReadiness({ params })` | `GET /organizations/:organizationId/member-source/csv-upload-readiness` | `params.organizationId` | `CsvUploadReadiness` |
|
|
313
314
|
| `client.memberSources.getOrganizationMemberSourceCsvMapping({ params })` | `GET /organizations/:organizationId/member-source/csv-mapping` | `params.organizationId` | `OrganizationMemberSourceCsvMapping \| null` |
|
|
314
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` |
|
|
315
317
|
| `client.memberSources.createOrganizationMemberSourceCsvUpload({ params, payload })` | `POST /organizations/:organizationId/member-source/csv-uploads` | `params.organizationId`, `CreateOrganizationMemberSourceCsvUploadInput` | `CreateOrganizationMemberSourceCsvUploadResponse` |
|
|
316
318
|
| `client.memberSources.listOrganizationMemberSyncRuns({ params, query })` | `GET /organizations/:organizationId/member-source/runs` | `params.organizationId`, optional `page`, `pageSize` | `PaginatedOrganizationMemberSyncRuns` |
|
|
317
319
|
| `client.memberSources.listOrganizationMemberSourceCommands({ params, query })` | `GET /organizations/:organizationId/member-source/commands` | `params.organizationId`, optional `page`, `pageSize` | `PaginatedOrganizationMemberSourceCommands` |
|
|
@@ -414,3 +416,71 @@ This is configuration discovery: it does not probe onsite connectivity or grant
|
|
|
414
416
|
operation permissions. An enabled capability can still fail at runtime. No
|
|
415
417
|
provider configuration, credentials, or agent metadata are returned. Missing
|
|
416
418
|
organizations return 404; callers without organization access are rejected.
|
|
419
|
+
|
|
420
|
+
Look up one member by its external system ID within an organization:
|
|
421
|
+
|
|
422
|
+
```ts
|
|
423
|
+
const [member, error] = await client.members.getByExternalSystemId({
|
|
424
|
+
organizationId: "org_123",
|
|
425
|
+
externalSystemMemberId: "EXT-1001",
|
|
426
|
+
});
|
|
427
|
+
```
|
|
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.
|