@spoketech/hub-client 0.4.0 → 0.5.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/dist/index.js CHANGED
@@ -1047,6 +1047,10 @@ var SourceMembershipObservationFields = {
1047
1047
  description: "Whether a confirmed Active source membership is past its paid-until instant. Null when the source membership or expiry is indeterminate."
1048
1048
  })
1049
1049
  };
1050
+ var MemberReplacementStatusSchema = Schema4.Struct({
1051
+ replacementMemberId: Schema4.String,
1052
+ delivered: Schema4.Boolean
1053
+ });
1050
1054
  var MemberSchema = Schema4.Struct({
1051
1055
  id: Schema4.String,
1052
1056
  organizationId: Schema4.String,
@@ -1402,6 +1406,30 @@ var OrganizationMemberSyncRunsListUrlParamsSchema = Schema4.Struct({
1402
1406
  {
1403
1407
  example: "5"
1404
1408
  }
1409
+ ),
1410
+ status: optionalQueryString(
1411
+ "Comma-separated statuses to include. Omit to include every status.",
1412
+ { example: "failure,partial_failure" }
1413
+ ),
1414
+ from: optionalQueryString(
1415
+ "Only include records started at or after this ISO-8601 instant.",
1416
+ { example: "2026-11-01T00:00:00.000Z" }
1417
+ ),
1418
+ to: optionalQueryString(
1419
+ "Only include records started at or before this ISO-8601 instant.",
1420
+ { example: "2026-11-30T23:59:59.999Z" }
1421
+ ),
1422
+ sort: optionalQueryString(
1423
+ "`newest` (default) or `oldest` first.",
1424
+ { example: "oldest" }
1425
+ ),
1426
+ trigger: optionalQueryString(
1427
+ "Comma-separated trigger kinds to include: manual, scheduled, bucket, live_feed.",
1428
+ { example: "manual,scheduled" }
1429
+ ),
1430
+ hideUnchanged: optionalQueryString(
1431
+ "`true` to leave out successful runs that inserted, updated and archived nothing and reported no errors.",
1432
+ { example: "true" }
1405
1433
  )
1406
1434
  });
1407
1435
  var MemberResponseModeUrlParamsSchema = Schema4.Struct({
@@ -1528,6 +1556,26 @@ var OrganizationMemberSourceCommandsListUrlParamsSchema = Schema4.Struct({
1528
1556
  {
1529
1557
  example: "25"
1530
1558
  }
1559
+ ),
1560
+ status: optionalQueryString(
1561
+ "Comma-separated statuses to include. Omit to include every status.",
1562
+ { example: "failure,partial_failure" }
1563
+ ),
1564
+ from: optionalQueryString(
1565
+ "Only include records requested at or after this ISO-8601 instant.",
1566
+ { example: "2026-11-01T00:00:00.000Z" }
1567
+ ),
1568
+ to: optionalQueryString(
1569
+ "Only include records requested at or before this ISO-8601 instant.",
1570
+ { example: "2026-11-30T23:59:59.999Z" }
1571
+ ),
1572
+ sort: optionalQueryString(
1573
+ "`newest` (default) or `oldest` first.",
1574
+ { example: "oldest" }
1575
+ ),
1576
+ kind: optionalQueryString(
1577
+ "Comma-separated command kinds to include, such as lookup_member or update_member.",
1578
+ { example: "lookup_member" }
1531
1579
  )
1532
1580
  });
1533
1581
  var ServiceClientsListUrlParamsSchema = Schema4.Struct({
@@ -2989,6 +3037,22 @@ var OrganizationMemberRatingGradeSchema = Schema4.Struct({
2989
3037
  ratingGrade: NullableString,
2990
3038
  ratingGradeId: NullableString
2991
3039
  });
3040
+ var OrganizationMemberSummarySchema = Schema4.Struct({
3041
+ organizationId: Schema4.String,
3042
+ total: Schema4.Number.annotate({
3043
+ description: "Members that have not been deleted, including archived members."
3044
+ }),
3045
+ notArchived: Schema4.Number,
3046
+ active: Schema4.Number.annotate({
3047
+ description: "Hub Member Status active, including Active-Expired Members within grace."
3048
+ }),
3049
+ suspended: Schema4.Number,
3050
+ expired: Schema4.Number,
3051
+ archived: Schema4.Number,
3052
+ sourceManaged: Schema4.Number,
3053
+ joinedLast30Days: Schema4.Number,
3054
+ generatedAt: TimestampSchema
3055
+ });
2992
3056
  var PaginatedOrganizationMemberRatingGradesSchema = Schema4.Struct({
2993
3057
  items: Schema4.Array(OrganizationMemberRatingGradeSchema),
2994
3058
  total: Schema4.Number,
@@ -3819,7 +3883,11 @@ var UpsertOrganizationMemberSourceWebhookSchema = Schema4.Struct({
3819
3883
  });
3820
3884
  var TriggerOrganizationMemberSyncSchema = Schema4.Struct({
3821
3885
  mode: Schema4.optional(Schema4.Literals([...organizationMemberSyncModes])),
3822
- inputReference: OptionalNullableString
3886
+ inputReference: OptionalNullableString,
3887
+ updatedAfter: OptionalNullableString.annotate({
3888
+ description: "Delta syncs only: venue wall time (YYYY-MM-DDTHH:mm[:ss[.SSS]], no offset) to read changes from for this run instead of the saved cursor. The saved cursor still advances normally when the run succeeds.",
3889
+ example: "2026-11-20T06:00:00"
3890
+ })
3823
3891
  });
3824
3892
  var OnsiteResourceCallWaitMsSchema = Schema4.optional(
3825
3893
  Schema4.Number.annotate({
@@ -4852,6 +4920,21 @@ var organizationsGroup = HttpApiGroup3.make("organizations").add(
4852
4920
  transform: organizationWriteExamplesTransform
4853
4921
  })
4854
4922
  )
4923
+ ).add(
4924
+ HttpApiEndpoint3.get(
4925
+ "getOrganization",
4926
+ "/organizations/:organizationId",
4927
+ {
4928
+ params: OrganizationParams,
4929
+ success: OrganizationSchema,
4930
+ error: CommonErrorSchemas
4931
+ }
4932
+ ).annotateMerge(
4933
+ OpenApi.annotations({
4934
+ summary: "Get an organization",
4935
+ description: "Requires organizations:read for the organization."
4936
+ })
4937
+ )
4855
4938
  ).add(
4856
4939
  HttpApiEndpoint3.patch(
4857
4940
  "updateOrganization",
@@ -4978,6 +5061,21 @@ var membersGroup = HttpApiGroup3.make("members").add(
4978
5061
  transform: bulkMemberExamplesTransform
4979
5062
  })
4980
5063
  )
5064
+ ).add(
5065
+ HttpApiEndpoint3.get(
5066
+ "getOrganizationMemberSummary",
5067
+ "/organizations/:organizationId/members/summary",
5068
+ {
5069
+ params: OrganizationIdParams,
5070
+ success: OrganizationMemberSummarySchema,
5071
+ error: CommonErrorSchemas
5072
+ }
5073
+ ).annotateMerge(
5074
+ OpenApi.annotations({
5075
+ summary: "Summarize member counts by Hub Member Status",
5076
+ description: "Requires members:read. Counts use the same Hub Member Status rules as the member list status filter."
5077
+ })
5078
+ )
4981
5079
  ).add(
4982
5080
  HttpApiEndpoint3.get(
4983
5081
  "listOrganizationMemberRatingGrades",
@@ -5054,6 +5152,30 @@ var membersGroup = HttpApiGroup3.make("members").add(
5054
5152
  transform: createMemberExamplesTransform
5055
5153
  })
5056
5154
  )
5155
+ ).add(
5156
+ HttpApiEndpoint3.get(
5157
+ "getMemberReplacement",
5158
+ "/organizations/:organizationId/members/:memberId/replacement",
5159
+ {
5160
+ params: OrganizationMemberParams,
5161
+ success: MemberReplacementStatusSchema,
5162
+ error: CommonErrorSchemas
5163
+ }
5164
+ )
5165
+ ).add(
5166
+ HttpApiEndpoint3.post(
5167
+ "replaceMember",
5168
+ "/organizations/:organizationId/members/:memberId/replacement",
5169
+ {
5170
+ params: OrganizationMemberParams,
5171
+ payload: Schema4.Union([
5172
+ Schema4.Struct({ replacementMemberId: Schema4.String, expectedUpdatedAt: Schema4.String }),
5173
+ Schema4.Struct({ retry: Schema4.Literal(true) })
5174
+ ]),
5175
+ success: MemberReplacementStatusSchema,
5176
+ error: CommonErrorSchemas
5177
+ }
5178
+ )
5057
5179
  ).add(
5058
5180
  HttpApiEndpoint3.post(
5059
5181
  "cleanupOrganizationMembers",
@@ -5379,7 +5501,12 @@ var vouchersGroup = HttpApiGroup3.make("vouchers").add(
5379
5501
  params: OrganizationIdParams,
5380
5502
  query: Schema4.Struct({
5381
5503
  page: Schema4.optional(Schema4.String),
5382
- pageSize: Schema4.optional(Schema4.String)
5504
+ pageSize: Schema4.optional(Schema4.String),
5505
+ status: optionalQueryString("Comma-separated statuses: requested, accepted, completed, failed."),
5506
+ kind: optionalQueryString("Comma-separated kinds: issue_voucher, lookup_voucher."),
5507
+ from: optionalQueryString("Only include commands requested at or after this ISO-8601 instant."),
5508
+ to: optionalQueryString("Only include commands requested at or before this ISO-8601 instant."),
5509
+ sort: optionalQueryString("`newest` (default) or `oldest` first.")
5383
5510
  }),
5384
5511
  success: PaginatedOrganizationVoucherCommandsSchema,
5385
5512
  error: CommonErrorSchemas
@@ -6603,7 +6730,8 @@ var MailchimpSettingsInputSchema = Schema4.Struct({
6603
6730
  firstNameField: Schema4.String,
6604
6731
  lastNameField: Schema4.String,
6605
6732
  phoneField: Schema4.optional(Schema4.String),
6606
- dobField: Schema4.optional(Schema4.String)
6733
+ dobField: Schema4.optional(Schema4.String),
6734
+ memberNumberField: Schema4.optional(Schema4.String)
6607
6735
  });
6608
6736
  var MailchimpSettingsSchema = Schema4.Struct({
6609
6737
  connected: Schema4.Boolean,
@@ -6614,6 +6742,7 @@ var MailchimpSettingsSchema = Schema4.Struct({
6614
6742
  lastNameField: Schema4.String,
6615
6743
  phoneField: Schema4.String,
6616
6744
  dobField: Schema4.String,
6745
+ memberNumberField: Schema4.String,
6617
6746
  pending: Schema4.Number,
6618
6747
  failed: Schema4.Number,
6619
6748
  lastSuccessAt: Schema4.NullOr(Schema4.String),
@@ -7258,6 +7387,17 @@ var makePromiseOnsiteResourceClient = async (options) => {
7258
7387
  };
7259
7388
 
7260
7389
  // src/spoke-client.ts
7390
+ function historyQuery(input) {
7391
+ const instant = (value) => value instanceof Date ? value.toISOString() : value;
7392
+ return {
7393
+ page: input.page,
7394
+ pageSize: input.pageSize,
7395
+ status: input.statuses,
7396
+ from: instant(input.from),
7397
+ to: instant(input.to),
7398
+ sort: input.sort
7399
+ };
7400
+ }
7261
7401
  function cleanParams(value) {
7262
7402
  return Object.fromEntries(
7263
7403
  Object.entries(value).filter(([, item]) => item !== void 0 && item !== null && item !== "").map(([key, item]) => [
@@ -7392,6 +7532,7 @@ function makeSpokeClient(hubClient) {
7392
7532
  )
7393
7533
  },
7394
7534
  organizations: {
7535
+ get: (input) => unwrap(hubClient.organizations.getOrganization({ params: input })),
7395
7536
  capabilities: (input) => unwrap(
7396
7537
  hubClient.organizations.getOrganizationCapabilities({ params: input })
7397
7538
  ),
@@ -7476,6 +7617,10 @@ function makeSpokeClient(hubClient) {
7476
7617
  })
7477
7618
  })
7478
7619
  ),
7620
+ /** Member counts for a venue, broken down by status. */
7621
+ summary: (input) => unwrap(
7622
+ hubClient.members.getOrganizationMemberSummary({ params: input })
7623
+ ),
7479
7624
  get: (input) => unwrap(
7480
7625
  hubClient.members.getOrganizationMember({
7481
7626
  params: {
@@ -7726,7 +7871,11 @@ function makeSpokeClient(hubClient) {
7726
7871
  list: (input) => unwrap(
7727
7872
  hubClient.memberSources.listOrganizationMemberSyncRuns({
7728
7873
  params: { organizationId: input.organizationId },
7729
- query: cleanParams(input)
7874
+ query: cleanParams({
7875
+ ...historyQuery(input),
7876
+ trigger: input.triggers,
7877
+ hideUnchanged: input.hideUnchanged ? "true" : void 0
7878
+ })
7730
7879
  })
7731
7880
  ),
7732
7881
  trigger: (input) => unwrap(
@@ -7740,7 +7889,7 @@ function makeSpokeClient(hubClient) {
7740
7889
  list: (input) => unwrap(
7741
7890
  hubClient.memberSources.listOrganizationMemberSourceCommands({
7742
7891
  params: { organizationId: input.organizationId },
7743
- query: cleanParams(input)
7892
+ query: cleanParams({ ...historyQuery(input), kind: input.kinds })
7744
7893
  })
7745
7894
  )
7746
7895
  }
@@ -7970,6 +8119,7 @@ export {
7970
8119
  MemberMedSchema,
7971
8120
  MemberPointBalanceSchema,
7972
8121
  MemberPointBalancesResponseSchema,
8122
+ MemberReplacementStatusSchema,
7973
8123
  MemberResponseModeSchema,
7974
8124
  MemberResponseSchema,
7975
8125
  MemberRewardSchema,
@@ -8034,6 +8184,7 @@ export {
8034
8184
  OrganizationMemberSourceSecretInputSchema,
8035
8185
  OrganizationMemberSourceWebhookSchema,
8036
8186
  OrganizationMemberSourceWebhookUpsertResponseSchema,
8187
+ OrganizationMemberSummarySchema,
8037
8188
  OrganizationMemberSyncRunErrorSchema,
8038
8189
  OrganizationMemberSyncRunSchema,
8039
8190
  OrganizationMemberSyncRunSummarySchema,