@spoketech/hub-client 0.3.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
@@ -828,6 +828,18 @@ var PointExecutionEvidenceSchema = Schema4.Struct({
828
828
  outcome: Schema4.Literals(["confirmed", "not_executed", "uncertain"]),
829
829
  detail: Schema4.String
830
830
  });
831
+ var PointExecutionStateSchema = Schema4.Literals([
832
+ "queued",
833
+ "dispatched",
834
+ "leased",
835
+ "uncertain",
836
+ "confirmed",
837
+ "not_executed",
838
+ "completed",
839
+ "failed"
840
+ ]).annotate({
841
+ description: "Execution state derived from status, delivery lease and evidence. Authorization immediately makes execution uncertain. Completed/failed without evidence are legacy outcomes, not proof of execution or non-execution."
842
+ });
831
843
  var OrganizationPointProviderSchema = Schema4.Struct({
832
844
  readiness: Schema4.optional(PointReadinessSchema),
833
845
  id: Schema4.String,
@@ -856,6 +868,7 @@ var OrganizationPointCommandResultSchema = Schema4.Struct({
856
868
  gatewayPacketNumber: OptionalNullableString
857
869
  });
858
870
  var OrganizationPointCommandSchema = Schema4.Struct({
871
+ executionState: Schema4.optional(PointExecutionStateSchema),
859
872
  executionEvidence: Schema4.optional(PointExecutionEvidenceSchema),
860
873
  id: Schema4.String,
861
874
  organizationId: Schema4.String,
@@ -1034,6 +1047,10 @@ var SourceMembershipObservationFields = {
1034
1047
  description: "Whether a confirmed Active source membership is past its paid-until instant. Null when the source membership or expiry is indeterminate."
1035
1048
  })
1036
1049
  };
1050
+ var MemberReplacementStatusSchema = Schema4.Struct({
1051
+ replacementMemberId: Schema4.String,
1052
+ delivered: Schema4.Boolean
1053
+ });
1037
1054
  var MemberSchema = Schema4.Struct({
1038
1055
  id: Schema4.String,
1039
1056
  organizationId: Schema4.String,
@@ -1389,6 +1406,30 @@ var OrganizationMemberSyncRunsListUrlParamsSchema = Schema4.Struct({
1389
1406
  {
1390
1407
  example: "5"
1391
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" }
1392
1433
  )
1393
1434
  });
1394
1435
  var MemberResponseModeUrlParamsSchema = Schema4.Struct({
@@ -1515,6 +1556,26 @@ var OrganizationMemberSourceCommandsListUrlParamsSchema = Schema4.Struct({
1515
1556
  {
1516
1557
  example: "25"
1517
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" }
1518
1579
  )
1519
1580
  });
1520
1581
  var ServiceClientsListUrlParamsSchema = Schema4.Struct({
@@ -2976,6 +3037,22 @@ var OrganizationMemberRatingGradeSchema = Schema4.Struct({
2976
3037
  ratingGrade: NullableString,
2977
3038
  ratingGradeId: NullableString
2978
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
+ });
2979
3056
  var PaginatedOrganizationMemberRatingGradesSchema = Schema4.Struct({
2980
3057
  items: Schema4.Array(OrganizationMemberRatingGradeSchema),
2981
3058
  total: Schema4.Number,
@@ -3806,7 +3883,11 @@ var UpsertOrganizationMemberSourceWebhookSchema = Schema4.Struct({
3806
3883
  });
3807
3884
  var TriggerOrganizationMemberSyncSchema = Schema4.Struct({
3808
3885
  mode: Schema4.optional(Schema4.Literals([...organizationMemberSyncModes])),
3809
- 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
+ })
3810
3891
  });
3811
3892
  var OnsiteResourceCallWaitMsSchema = Schema4.optional(
3812
3893
  Schema4.Number.annotate({
@@ -4839,6 +4920,21 @@ var organizationsGroup = HttpApiGroup3.make("organizations").add(
4839
4920
  transform: organizationWriteExamplesTransform
4840
4921
  })
4841
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
+ )
4842
4938
  ).add(
4843
4939
  HttpApiEndpoint3.patch(
4844
4940
  "updateOrganization",
@@ -4965,6 +5061,21 @@ var membersGroup = HttpApiGroup3.make("members").add(
4965
5061
  transform: bulkMemberExamplesTransform
4966
5062
  })
4967
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
+ )
4968
5079
  ).add(
4969
5080
  HttpApiEndpoint3.get(
4970
5081
  "listOrganizationMemberRatingGrades",
@@ -5041,6 +5152,30 @@ var membersGroup = HttpApiGroup3.make("members").add(
5041
5152
  transform: createMemberExamplesTransform
5042
5153
  })
5043
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
+ )
5044
5179
  ).add(
5045
5180
  HttpApiEndpoint3.post(
5046
5181
  "cleanupOrganizationMembers",
@@ -5366,7 +5501,12 @@ var vouchersGroup = HttpApiGroup3.make("vouchers").add(
5366
5501
  params: OrganizationIdParams,
5367
5502
  query: Schema4.Struct({
5368
5503
  page: Schema4.optional(Schema4.String),
5369
- 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.")
5370
5510
  }),
5371
5511
  success: PaginatedOrganizationVoucherCommandsSchema,
5372
5512
  error: CommonErrorSchemas
@@ -6589,8 +6729,9 @@ var MailchimpSettingsInputSchema = Schema4.Struct({
6589
6729
  welcomeTag: Schema4.String,
6590
6730
  firstNameField: Schema4.String,
6591
6731
  lastNameField: Schema4.String,
6592
- phoneField: Schema4.String,
6593
- dobField: Schema4.String
6732
+ phoneField: Schema4.optional(Schema4.String),
6733
+ dobField: Schema4.optional(Schema4.String),
6734
+ memberNumberField: Schema4.optional(Schema4.String)
6594
6735
  });
6595
6736
  var MailchimpSettingsSchema = Schema4.Struct({
6596
6737
  connected: Schema4.Boolean,
@@ -6601,6 +6742,7 @@ var MailchimpSettingsSchema = Schema4.Struct({
6601
6742
  lastNameField: Schema4.String,
6602
6743
  phoneField: Schema4.String,
6603
6744
  dobField: Schema4.String,
6745
+ memberNumberField: Schema4.String,
6604
6746
  pending: Schema4.Number,
6605
6747
  failed: Schema4.Number,
6606
6748
  lastSuccessAt: Schema4.NullOr(Schema4.String),
@@ -6686,7 +6828,12 @@ var mailchimpGroup = HttpApiGroup3.make("mailchimp").add(
6686
6828
  params: Schema4.Struct({ organizationId: Schema4.String, audienceId: Schema4.String }),
6687
6829
  success: Schema4.Struct({
6688
6830
  fields: Schema4.Array(
6689
- Schema4.Struct({ tag: Schema4.String, name: Schema4.String, type: Schema4.String })
6831
+ Schema4.Struct({
6832
+ tag: Schema4.String,
6833
+ name: Schema4.String,
6834
+ type: Schema4.String,
6835
+ dateFormat: Schema4.optional(Schema4.String)
6836
+ })
6690
6837
  )
6691
6838
  }),
6692
6839
  error: CommonErrorSchemas
@@ -6704,6 +6851,16 @@ var mailchimpGroup = HttpApiGroup3.make("mailchimp").add(
6704
6851
  success: Schema4.Struct({ queued: Schema4.Number }),
6705
6852
  error: CommonErrorSchemas
6706
6853
  })
6854
+ ).add(
6855
+ HttpApiEndpoint3.post(
6856
+ "syncMailchimpMember",
6857
+ "/organizations/:organizationId/mailchimp/members/:memberId/sync",
6858
+ {
6859
+ params: OrganizationMemberParams,
6860
+ success: Schema4.Struct({ queued: Schema4.Number }),
6861
+ error: CommonErrorSchemas
6862
+ }
6863
+ )
6707
6864
  ).add(
6708
6865
  HttpApiEndpoint3.post("retryMailchimp", "/organizations/:organizationId/mailchimp/retry", {
6709
6866
  params: OrganizationIdParams,
@@ -7230,6 +7387,17 @@ var makePromiseOnsiteResourceClient = async (options) => {
7230
7387
  };
7231
7388
 
7232
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
+ }
7233
7401
  function cleanParams(value) {
7234
7402
  return Object.fromEntries(
7235
7403
  Object.entries(value).filter(([, item]) => item !== void 0 && item !== null && item !== "").map(([key, item]) => [
@@ -7364,6 +7532,7 @@ function makeSpokeClient(hubClient) {
7364
7532
  )
7365
7533
  },
7366
7534
  organizations: {
7535
+ get: (input) => unwrap(hubClient.organizations.getOrganization({ params: input })),
7367
7536
  capabilities: (input) => unwrap(
7368
7537
  hubClient.organizations.getOrganizationCapabilities({ params: input })
7369
7538
  ),
@@ -7448,6 +7617,10 @@ function makeSpokeClient(hubClient) {
7448
7617
  })
7449
7618
  })
7450
7619
  ),
7620
+ /** Member counts for a venue, broken down by status. */
7621
+ summary: (input) => unwrap(
7622
+ hubClient.members.getOrganizationMemberSummary({ params: input })
7623
+ ),
7451
7624
  get: (input) => unwrap(
7452
7625
  hubClient.members.getOrganizationMember({
7453
7626
  params: {
@@ -7698,7 +7871,11 @@ function makeSpokeClient(hubClient) {
7698
7871
  list: (input) => unwrap(
7699
7872
  hubClient.memberSources.listOrganizationMemberSyncRuns({
7700
7873
  params: { organizationId: input.organizationId },
7701
- query: cleanParams(input)
7874
+ query: cleanParams({
7875
+ ...historyQuery(input),
7876
+ trigger: input.triggers,
7877
+ hideUnchanged: input.hideUnchanged ? "true" : void 0
7878
+ })
7702
7879
  })
7703
7880
  ),
7704
7881
  trigger: (input) => unwrap(
@@ -7712,7 +7889,7 @@ function makeSpokeClient(hubClient) {
7712
7889
  list: (input) => unwrap(
7713
7890
  hubClient.memberSources.listOrganizationMemberSourceCommands({
7714
7891
  params: { organizationId: input.organizationId },
7715
- query: cleanParams(input)
7892
+ query: cleanParams({ ...historyQuery(input), kind: input.kinds })
7716
7893
  })
7717
7894
  )
7718
7895
  }
@@ -7942,6 +8119,7 @@ export {
7942
8119
  MemberMedSchema,
7943
8120
  MemberPointBalanceSchema,
7944
8121
  MemberPointBalancesResponseSchema,
8122
+ MemberReplacementStatusSchema,
7945
8123
  MemberResponseModeSchema,
7946
8124
  MemberResponseSchema,
7947
8125
  MemberRewardSchema,
@@ -8006,6 +8184,7 @@ export {
8006
8184
  OrganizationMemberSourceSecretInputSchema,
8007
8185
  OrganizationMemberSourceWebhookSchema,
8008
8186
  OrganizationMemberSourceWebhookUpsertResponseSchema,
8187
+ OrganizationMemberSummarySchema,
8009
8188
  OrganizationMemberSyncRunErrorSchema,
8010
8189
  OrganizationMemberSyncRunSchema,
8011
8190
  OrganizationMemberSyncRunSummarySchema,
@@ -8048,6 +8227,7 @@ export {
8048
8227
  PaginatedServiceClientsSchema,
8049
8228
  PhysicalRewardBenefitSchema,
8050
8229
  PointExecutionEvidenceSchema,
8230
+ PointExecutionStateSchema,
8051
8231
  PointReadinessSchema,
8052
8232
  PointRequestMetadataSchema,
8053
8233
  PresignedPostSchema,