@spoketech/hub-client 0.1.15 → 0.1.16

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
@@ -40,6 +40,7 @@ var organizationMemberSourceManualTransports = ["csv_bucket"];
40
40
  var organizationMemberSourceLiveTransports = ["fbi"];
41
41
  var organizationMemberSourceStatuses = ["active", "paused", "disabled"];
42
42
  var organizationMemberSourceAgentStatuses = ["active", "paused", "disabled"];
43
+ var organizationMemberSourceAgentCapabilities = ["ensure_active_membership"];
43
44
  var organizationMemberSourceWebhookStatuses = ["active", "disabled"];
44
45
  var organizationMemberSourceWebhookDeliveryStatuses = ["success", "failure"];
45
46
  var organizationProductWebhookStatuses = ["active", "disabled"];
@@ -91,12 +92,23 @@ var organizationMemberSyncTransports = [
91
92
  ];
92
93
  var organizationMemberSourceCommandKinds = [
93
94
  "create_member",
95
+ "ensure_active_membership",
94
96
  "update_member",
95
97
  "update_preferences",
96
98
  "renew_member",
97
99
  "lookup_member",
98
100
  "list_custom_fields"
99
101
  ];
102
+ var ensureActiveMembershipOutcomes = [
103
+ "created",
104
+ "matched_active",
105
+ "renewed_existing",
106
+ "ambiguous_identity_match",
107
+ "unsupported_source_status",
108
+ "indeterminate_membership_expiry",
109
+ "manual_review_required",
110
+ "failed"
111
+ ];
100
112
  var organizationMemberSourceCommandStatuses = [
101
113
  "requested",
102
114
  "accepted",
@@ -126,6 +138,7 @@ var ForbiddenErrorSchema = makeErrorSchema("forbidden", 403);
126
138
  var NotFoundErrorSchema = makeErrorSchema("not_found", 404);
127
139
  var ConflictErrorSchema = makeErrorSchema("conflict", 409);
128
140
  var BadRequestErrorSchema = makeErrorSchema("bad_request", 400);
141
+ var InternalServerErrorSchema = makeErrorSchema("internal_error", 500);
129
142
  function makeUnauthorized(message = "Authentication required") {
130
143
  return { code: "unauthorized", message };
131
144
  }
@@ -141,6 +154,9 @@ function makeConflict(message) {
141
154
  function makeBadRequest(message) {
142
155
  return { code: "bad_request", message };
143
156
  }
157
+ function makeInternalServerError() {
158
+ return { code: "internal_error", message: "Internal server error" };
159
+ }
144
160
 
145
161
  // ../contracts/src/contracts.ts
146
162
  var NullableString = Schema2.Union(Schema2.String, Schema2.Null);
@@ -528,6 +544,9 @@ var SourceMembershipObservationFields = {
528
544
  }),
529
545
  sourceStatusObservedAt: Schema2.Union(TimestampSchema, Schema2.Null).annotations({
530
546
  description: "Time Spoke Hub last observed a non-empty Source Membership Status."
547
+ }),
548
+ renewalRequired: Schema2.Union(Schema2.Boolean, Schema2.Null).annotations({
549
+ description: "Whether a confirmed Active source membership is past its paid-until instant. Null when the source membership or expiry is indeterminate."
531
550
  })
532
551
  };
533
552
  var MemberSchema = Schema2.Struct({
@@ -1087,6 +1106,7 @@ var organizationMembersListExamples = {
1087
1106
  sourceUpdatedAt: "2026-04-02T01:23:45.000Z",
1088
1107
  sourceStatus: "ACTIVE",
1089
1108
  sourceStatusObservedAt: "2026-04-02T01:25:00.000Z",
1109
+ renewalRequired: null,
1090
1110
  email: "jane@example.com",
1091
1111
  title: "Ms",
1092
1112
  firstName: "Jane",
@@ -1159,6 +1179,7 @@ var organizationMembersListExamples = {
1159
1179
  isSuspended: false,
1160
1180
  sourceStatus: "ACTIVE",
1161
1181
  sourceStatusObservedAt: "2026-04-02T01:25:00.000Z",
1182
+ renewalRequired: null,
1162
1183
  displayName: "Jane Smith",
1163
1184
  dob: "1988-06-14",
1164
1185
  email: "jane@example.com",
@@ -1205,6 +1226,7 @@ var organizationMembersListExamples = {
1205
1226
  dob: "1988-06-14",
1206
1227
  sourceStatus: "ACTIVE",
1207
1228
  sourceStatusObservedAt: "2026-04-02T01:25:00.000Z",
1229
+ renewalRequired: null,
1208
1230
  memberNumber: "12345"
1209
1231
  }
1210
1232
  ],
@@ -1259,6 +1281,7 @@ var memberExamples = {
1259
1281
  sourceUpdatedAt: "2026-04-02T01:23:45.000Z",
1260
1282
  sourceStatus: "ACTIVE",
1261
1283
  sourceStatusObservedAt: "2026-04-02T01:25:00.000Z",
1284
+ renewalRequired: null,
1262
1285
  email: "jane@example.com",
1263
1286
  title: "Ms",
1264
1287
  firstName: "Jane",
@@ -1319,6 +1342,7 @@ var memberExamples = {
1319
1342
  isSuspended: false,
1320
1343
  sourceStatus: "ACTIVE",
1321
1344
  sourceStatusObservedAt: "2026-04-02T01:25:00.000Z",
1345
+ renewalRequired: null,
1322
1346
  displayName: "Jane Smith",
1323
1347
  dob: "1988-06-14",
1324
1348
  email: "jane@example.com",
@@ -1353,6 +1377,7 @@ var memberExamples = {
1353
1377
  dob: "1988-06-14",
1354
1378
  sourceStatus: "ACTIVE",
1355
1379
  sourceStatusObservedAt: "2026-04-02T01:25:00.000Z",
1380
+ renewalRequired: null,
1356
1381
  memberNumber: "12345",
1357
1382
  responseMode: "basic"
1358
1383
  }
@@ -1382,6 +1407,7 @@ var bulkMemberExamples = {
1382
1407
  isSuspended: false,
1383
1408
  sourceStatus: "ACTIVE",
1384
1409
  sourceStatusObservedAt: "2026-04-02T01:25:00.000Z",
1410
+ renewalRequired: null,
1385
1411
  displayName: "Jane Smith",
1386
1412
  dob: "1988-06-14",
1387
1413
  email: "jane@example.com",
@@ -1413,6 +1439,7 @@ var bulkMemberExamples = {
1413
1439
  isSuspended: false,
1414
1440
  sourceStatus: null,
1415
1441
  sourceStatusObservedAt: null,
1442
+ renewalRequired: null,
1416
1443
  displayName: "Howard Sorrell",
1417
1444
  dob: "1967-05-09",
1418
1445
  email: null,
@@ -1792,6 +1819,7 @@ var createMemberExamplesTransform = withOpenApiExamples({
1792
1819
  sourceUpdatedAt: null,
1793
1820
  sourceStatus: null,
1794
1821
  sourceStatusObservedAt: null,
1822
+ renewalRequired: null,
1795
1823
  email: "jane@example.com",
1796
1824
  title: "Ms",
1797
1825
  firstName: "Jane",
@@ -1878,6 +1906,7 @@ var updateMemberExamplesTransform = withOpenApiExamples({
1878
1906
  sourceUpdatedAt: null,
1879
1907
  sourceStatus: null,
1880
1908
  sourceStatusObservedAt: null,
1909
+ renewalRequired: null,
1881
1910
  email: "jane@example.com",
1882
1911
  title: "Ms",
1883
1912
  firstName: "Jane",
@@ -1965,6 +1994,109 @@ var sourceManagedCreateExamplesTransform = withOpenApiExamples({
1965
1994
  },
1966
1995
  responseStatus: "202"
1967
1996
  });
1997
+ var ensureActiveMembershipExamplesTransform = withOpenApiExamples({
1998
+ requestExamples: {
1999
+ accepted: {
2000
+ summary: "Ensure an Odyssey membership is active",
2001
+ value: {
2002
+ idempotencyKey: "venue-join-123",
2003
+ member: {
2004
+ firstName: "Jane",
2005
+ lastName: "Smith",
2006
+ dob: "1988-06-14",
2007
+ membershipTypeId: "12",
2008
+ mobilePhone: "+61490451502"
2009
+ }
2010
+ }
2011
+ },
2012
+ boundedWait: {
2013
+ summary: "Wait briefly for a terminal business outcome",
2014
+ value: {
2015
+ idempotencyKey: "venue-join-124",
2016
+ waitMs: 1e4,
2017
+ member: {
2018
+ firstName: "Jane",
2019
+ lastName: "Smith",
2020
+ dob: "1988-06-14",
2021
+ membershipTypeId: "12"
2022
+ }
2023
+ }
2024
+ }
2025
+ },
2026
+ responseExamples: {
2027
+ accepted: {
2028
+ summary: "Accepted command",
2029
+ value: {
2030
+ settled: false,
2031
+ timedOut: false,
2032
+ command: {
2033
+ id: "cmd_123",
2034
+ organizationId: "org_1",
2035
+ organizationMemberSourceId: "src_9",
2036
+ organizationMemberSourceAgentId: "agt_1",
2037
+ kind: "ensure_active_membership",
2038
+ status: "accepted",
2039
+ payload: {
2040
+ idempotencyKey: "venue-join-123",
2041
+ member: {
2042
+ firstName: "Jane",
2043
+ lastName: "Smith",
2044
+ dob: "1988-06-14",
2045
+ membershipTypeId: "12"
2046
+ }
2047
+ },
2048
+ result: null,
2049
+ errorMessage: null,
2050
+ requestedAt: "2026-08-20T01:02:05.123Z",
2051
+ acceptedAt: "2026-08-20T01:02:05.200Z",
2052
+ completedAt: null,
2053
+ createdAt: "2026-08-20T01:02:05.123Z",
2054
+ updatedAt: "2026-08-20T01:02:05.200Z",
2055
+ deletedAt: null
2056
+ }
2057
+ }
2058
+ },
2059
+ completed: {
2060
+ summary: "Completed within the bounded wait",
2061
+ value: {
2062
+ settled: true,
2063
+ timedOut: false,
2064
+ command: {
2065
+ id: "cmd_124",
2066
+ organizationId: "org_1",
2067
+ organizationMemberSourceId: "src_9",
2068
+ organizationMemberSourceAgentId: "agt_1",
2069
+ kind: "ensure_active_membership",
2070
+ status: "completed",
2071
+ payload: {
2072
+ idempotencyKey: "venue-join-124",
2073
+ member: {
2074
+ firstName: "Jane",
2075
+ lastName: "Smith",
2076
+ dob: "1988-06-14",
2077
+ membershipTypeId: "12"
2078
+ }
2079
+ },
2080
+ result: {
2081
+ outcome: "matched_active",
2082
+ memberId: "mem_123",
2083
+ sourceStatus: "ACTIVE",
2084
+ membershipTypeId: "12",
2085
+ membershipExpiry: "2027-08-20T00:00:00.000Z"
2086
+ },
2087
+ errorMessage: null,
2088
+ requestedAt: "2026-08-20T01:02:05.123Z",
2089
+ acceptedAt: "2026-08-20T01:02:05.200Z",
2090
+ completedAt: "2026-08-20T01:02:05.500Z",
2091
+ createdAt: "2026-08-20T01:02:05.123Z",
2092
+ updatedAt: "2026-08-20T01:02:05.500Z",
2093
+ deletedAt: null
2094
+ }
2095
+ }
2096
+ }
2097
+ },
2098
+ responseStatus: "202"
2099
+ });
1968
2100
  var sourceManagedRenewalExamplesTransform = withOpenApiExamples({
1969
2101
  requestExamples: {
1970
2102
  default: {
@@ -2429,6 +2561,10 @@ var OrganizationMemberSourceAgentSchema = Schema2.Struct({
2429
2561
  lastHeartbeatAt: Schema2.Union(TimestampSchema, Schema2.Null),
2430
2562
  lastVersion: NullableString,
2431
2563
  lastError: NullableString,
2564
+ capabilities: Schema2.optionalWith(
2565
+ Schema2.Array(Schema2.Literal(...organizationMemberSourceAgentCapabilities)),
2566
+ { default: () => [] }
2567
+ ),
2432
2568
  metadata: JsonObjectSchema,
2433
2569
  createdAt: TimestampSchema,
2434
2570
  updatedAt: TimestampSchema,
@@ -2560,6 +2696,35 @@ var OrganizationMemberSourceCommandSchema = Schema2.Struct({
2560
2696
  updatedAt: TimestampSchema,
2561
2697
  deletedAt: Schema2.Union(TimestampSchema, Schema2.Null)
2562
2698
  });
2699
+ var EnsureActiveMembershipSuccessOutcomeSchema = Schema2.Literal(
2700
+ "created",
2701
+ "matched_active",
2702
+ "renewed_existing"
2703
+ );
2704
+ var EnsureActiveMembershipNonSuccessOutcomeSchema = Schema2.Literal(
2705
+ "ambiguous_identity_match",
2706
+ "unsupported_source_status",
2707
+ "indeterminate_membership_expiry",
2708
+ "manual_review_required",
2709
+ "failed"
2710
+ );
2711
+ var EnsureActiveMembershipOutcomeSchema = Schema2.Literal(
2712
+ ...ensureActiveMembershipOutcomes
2713
+ );
2714
+ var EnsureActiveMembershipSuccessResultSchema = Schema2.Struct({
2715
+ outcome: EnsureActiveMembershipSuccessOutcomeSchema,
2716
+ memberId: Schema2.String,
2717
+ sourceStatus: Schema2.Literal("ACTIVE"),
2718
+ membershipTypeId: Schema2.String,
2719
+ membershipExpiry: TimestampSchema
2720
+ });
2721
+ var EnsureActiveMembershipNonSuccessResultSchema = Schema2.Struct({
2722
+ outcome: EnsureActiveMembershipNonSuccessOutcomeSchema
2723
+ });
2724
+ var EnsureActiveMembershipResultSchema = Schema2.Union(
2725
+ EnsureActiveMembershipSuccessResultSchema,
2726
+ EnsureActiveMembershipNonSuccessResultSchema
2727
+ );
2563
2728
  var PaginatedOrganizationMemberSourceCommandsSchema = Schema2.Struct({
2564
2729
  items: Schema2.Array(OrganizationMemberSourceCommandSchema),
2565
2730
  total: Schema2.Number,
@@ -2923,7 +3088,57 @@ var TriggerOrganizationMemberSyncSchema = Schema2.Struct({
2923
3088
  mode: Schema2.optional(Schema2.Literal(...organizationMemberSyncModes)),
2924
3089
  inputReference: OptionalNullableString
2925
3090
  });
3091
+ var OnsiteResourceCallWaitMsSchema = Schema2.optional(
3092
+ Schema2.Number.annotations({
3093
+ description: "How long Hub should wait for the onsite client to complete the command before returning the accepted command.",
3094
+ example: 1e4
3095
+ })
3096
+ );
2926
3097
  var RequestSourceManagedMemberCreateSchema = CreateMemberSchema;
3098
+ var EnsureActiveMembershipMemberSchema = Schema2.Struct({
3099
+ email: OptionalNullableString,
3100
+ title: OptionalNullableString,
3101
+ firstName: Schema2.String,
3102
+ middleName: OptionalNullableString,
3103
+ lastName: Schema2.String,
3104
+ dob: DateOnlySchema,
3105
+ gender: OptionalNullableString,
3106
+ mobilePhone: OptionalNullableMobilePhoneSchema,
3107
+ homePhone: OptionalNullableString,
3108
+ preferredContactMethod: OptionalNullablePreferredContactMethodSchema,
3109
+ occupation: OptionalNullableOccupationSchema,
3110
+ address: Schema2.optional(Schema2.Union(AddressInputSchema, Schema2.Null)),
3111
+ postalAddress: Schema2.optional(Schema2.Union(AddressInputSchema, Schema2.Null)),
3112
+ membershipTypeId: Schema2.String,
3113
+ marketingPreferences: Schema2.optional(MarketingPreferencesInputSchema)
3114
+ });
3115
+ var EnsureActiveMembershipIdempotencyKeySchema = Schema2.String.pipe(
3116
+ Schema2.nonEmptyString(),
3117
+ Schema2.maxLength(64)
3118
+ ).annotations({
3119
+ description: "Caller-provided key used to replay this operation safely.",
3120
+ example: "venue-join-123"
3121
+ });
3122
+ var EnsureActiveMembershipCommandPayloadSchema = Schema2.Struct({
3123
+ idempotencyKey: EnsureActiveMembershipIdempotencyKeySchema,
3124
+ member: EnsureActiveMembershipMemberSchema
3125
+ });
3126
+ var RequestEnsureActiveMembershipSchema = Schema2.Struct({
3127
+ idempotencyKey: EnsureActiveMembershipIdempotencyKeySchema,
3128
+ waitMs: OnsiteResourceCallWaitMsSchema,
3129
+ member: EnsureActiveMembershipMemberSchema
3130
+ });
3131
+ var EnsureActiveMembershipCommandSchema = Schema2.Struct({
3132
+ ...OrganizationMemberSourceCommandSchema.fields,
3133
+ kind: Schema2.Literal("ensure_active_membership"),
3134
+ payload: EnsureActiveMembershipCommandPayloadSchema,
3135
+ result: Schema2.Union(EnsureActiveMembershipResultSchema, Schema2.Null)
3136
+ });
3137
+ var EnsureActiveMembershipResponseSchema = Schema2.Struct({
3138
+ settled: Schema2.Boolean,
3139
+ timedOut: Schema2.Boolean,
3140
+ command: EnsureActiveMembershipCommandSchema
3141
+ });
2927
3142
  var RequestSourceManagedMemberUpdateSchema = UpdateMemberSchema;
2928
3143
  var RequestSourceManagedMemberPreferenceUpdateSchema = Schema2.Struct({
2929
3144
  expectedUpdatedAt: TimestampSchema,
@@ -2955,13 +3170,13 @@ var SourceManagedMemberPreferenceUpdateCommandPayloadSchema = Schema2.Struct({
2955
3170
  expectedUpdatedAt: TimestampSchema,
2956
3171
  marketingPreferences: MarketingPreferencesInputSchema
2957
3172
  });
2958
- var OnsiteResourceCallWaitMsSchema = Schema2.optional(
2959
- Schema2.Number.annotations({
2960
- description: "How long Hub should wait for the onsite client to complete the command before returning the accepted command.",
2961
- example: 1e4
2962
- })
2963
- );
2964
3173
  var OnsiteResourceCallRequestSchema = Schema2.Union(
3174
+ Schema2.Struct({
3175
+ operation: Schema2.Literal("member.ensure_active"),
3176
+ waitMs: OnsiteResourceCallWaitMsSchema,
3177
+ idempotencyKey: EnsureActiveMembershipIdempotencyKeySchema,
3178
+ member: EnsureActiveMembershipMemberSchema
3179
+ }),
2965
3180
  Schema2.Struct({
2966
3181
  operation: Schema2.Literal("member.create"),
2967
3182
  waitMs: OnsiteResourceCallWaitMsSchema,
@@ -3022,6 +3237,13 @@ var OnsiteResourceMemberCallResponseSchema = Schema2.Struct({
3022
3237
  timedOut: Schema2.Boolean,
3023
3238
  command: OrganizationMemberSourceCommandSchema
3024
3239
  });
3240
+ var OnsiteResourceEnsureActiveMembershipCallResponseSchema = Schema2.Struct({
3241
+ kind: Schema2.Literal("member"),
3242
+ operation: Schema2.Literal("member.ensure_active"),
3243
+ settled: Schema2.Boolean,
3244
+ timedOut: Schema2.Boolean,
3245
+ command: EnsureActiveMembershipCommandSchema
3246
+ });
3025
3247
  var OnsiteResourceVoucherCallResponseSchema = Schema2.Struct({
3026
3248
  kind: Schema2.Literal("voucher"),
3027
3249
  operation: Schema2.Literal("voucher.issue", "voucher.lookup"),
@@ -3037,6 +3259,7 @@ var OnsiteResourcePointCallResponseSchema = Schema2.Struct({
3037
3259
  command: OrganizationPointCommandSchema
3038
3260
  });
3039
3261
  var OnsiteResourceCallResponseSchema = Schema2.Union(
3262
+ OnsiteResourceEnsureActiveMembershipCallResponseSchema,
3040
3263
  OnsiteResourceMemberCallResponseSchema,
3041
3264
  OnsiteResourceVoucherCallResponseSchema,
3042
3265
  OnsiteResourcePointCallResponseSchema
@@ -3163,6 +3386,17 @@ var OnsiteAgentMemberCreateCommandSchema = Schema2.Struct({
3163
3386
  config: JsonObjectSchema,
3164
3387
  secrets: Schema2.Array(OrganizationMemberSourceSecretInputSchema)
3165
3388
  });
3389
+ var OnsiteAgentEnsureActiveMembershipCommandSchema = Schema2.Struct({
3390
+ commandId: Schema2.String,
3391
+ organizationId: Schema2.String,
3392
+ organizationMemberSourceId: Schema2.String,
3393
+ vendor: Schema2.Literal("odyssey_gaming"),
3394
+ connectorType: Schema2.Literal("odyssey_gaming"),
3395
+ requestedAt: TimestampSchema,
3396
+ payload: EnsureActiveMembershipCommandPayloadSchema,
3397
+ config: JsonObjectSchema,
3398
+ secrets: Schema2.Array(OrganizationMemberSourceSecretInputSchema)
3399
+ });
3166
3400
  var OnsiteAgentMemberUpdateCommandSchema = Schema2.Struct({
3167
3401
  commandId: Schema2.String,
3168
3402
  organizationId: Schema2.String,
@@ -3221,6 +3455,9 @@ var OnsiteAgentCustomFieldsCommandSchema = Schema2.Struct({
3221
3455
  var OnsiteAgentHeartbeatSchema = Schema2.Struct({
3222
3456
  version: Schema2.String,
3223
3457
  pollingIntervalSeconds: Schema2.optional(Schema2.Number),
3458
+ capabilities: Schema2.optional(
3459
+ Schema2.Array(Schema2.Literal(...organizationMemberSourceAgentCapabilities))
3460
+ ),
3224
3461
  metadata: Schema2.optional(JsonObjectSchema),
3225
3462
  lastError: OptionalNullableString
3226
3463
  });
@@ -3279,6 +3516,31 @@ var OnsiteAgentCompleteMemberCreateSchema = Schema2.Struct({
3279
3516
  record: Schema2.optional(ImportedMemberRecordSchema),
3280
3517
  contactPreferences: Schema2.optional(Schema2.Array(SourceContactPreferenceSchema)),
3281
3518
  creationResult: Schema2.optional(OnsiteAgentMemberCreationResultSchema),
3519
+ ensureOutcome: Schema2.optional(EnsureActiveMembershipOutcomeSchema),
3520
+ errorMessage: OptionalNullableString
3521
+ });
3522
+ var OnsiteAgentEnsureActiveMembershipRecordSchema = Schema2.Struct({
3523
+ ...ImportedMemberRecordSchema.fields,
3524
+ sourceStatus: Schema2.Literal("ACTIVE"),
3525
+ membershipTypeId: Schema2.String,
3526
+ expiresAt: TimestampSchema
3527
+ });
3528
+ var OnsiteAgentEnsureActiveMembershipCreatedResultSchema = Schema2.Struct({
3529
+ outcome: Schema2.Literal("created"),
3530
+ record: OnsiteAgentEnsureActiveMembershipRecordSchema,
3531
+ creationResult: Schema2.Literal("created", "recovered_create")
3532
+ });
3533
+ var OnsiteAgentEnsureActiveMembershipExistingResultSchema = Schema2.Struct({
3534
+ outcome: Schema2.Literal("matched_active", "renewed_existing"),
3535
+ record: OnsiteAgentEnsureActiveMembershipRecordSchema
3536
+ });
3537
+ var OnsiteAgentEnsureActiveMembershipCompletionResultSchema = Schema2.Union(
3538
+ OnsiteAgentEnsureActiveMembershipCreatedResultSchema,
3539
+ OnsiteAgentEnsureActiveMembershipExistingResultSchema,
3540
+ EnsureActiveMembershipNonSuccessResultSchema
3541
+ );
3542
+ var OnsiteAgentCompleteEnsureActiveMembershipSchema = Schema2.Struct({
3543
+ result: Schema2.optional(OnsiteAgentEnsureActiveMembershipCompletionResultSchema),
3282
3544
  errorMessage: OptionalNullableString
3283
3545
  });
3284
3546
  var OnsiteAgentCompleteMemberUpdateSchema = Schema2.Struct({
@@ -3577,6 +3839,16 @@ var membersGroup = HttpApiGroup.make("members").add(
3577
3839
  transform: sourceManagedCreateExamplesTransform
3578
3840
  })
3579
3841
  )
3842
+ ).add(
3843
+ HttpApiEndpoint.post(
3844
+ "ensureActiveMembership",
3845
+ "/organizations/:organizationId/members/ensure-active"
3846
+ ).setPath(OrganizationIdParams).setPayload(RequestEnsureActiveMembershipSchema).addSuccess(EnsureActiveMembershipResponseSchema, { status: 202 }).annotateContext(
3847
+ OpenApi.annotations({
3848
+ summary: "Ensure an Odyssey membership is active",
3849
+ transform: ensureActiveMembershipExamplesTransform
3850
+ })
3851
+ )
3580
3852
  ).add(
3581
3853
  HttpApiEndpoint.post(
3582
3854
  "requestSourceManagedMemberRenewal",
@@ -3982,6 +4254,15 @@ var onsiteAgentsGroup = HttpApiGroup.make("onsiteAgents").add(
3982
4254
  HttpApiEndpoint.post("pollOnsiteAgentMemberCreateCommand", "/onsite-agent/member-commands/poll").addSuccess(Schema2.Union(OnsiteAgentMemberCreateCommandSchema, Schema2.Null)).annotateContext(
3983
4255
  OpenApi.annotations({ summary: "Poll for the next pending onsite member-create command" })
3984
4256
  )
4257
+ ).add(
4258
+ HttpApiEndpoint.post(
4259
+ "pollOnsiteAgentEnsureActiveMembershipCommand",
4260
+ "/onsite-agent/ensure-active-membership-commands/poll"
4261
+ ).addSuccess(Schema2.Union(OnsiteAgentEnsureActiveMembershipCommandSchema, Schema2.Null)).annotateContext(
4262
+ OpenApi.annotations({
4263
+ summary: "Poll for the next Ensure Active Membership command"
4264
+ })
4265
+ )
3985
4266
  ).add(
3986
4267
  HttpApiEndpoint.post(
3987
4268
  "pollOnsiteAgentMemberUpdateCommand",
@@ -4050,6 +4331,19 @@ var onsiteAgentsGroup = HttpApiGroup.make("onsiteAgents").add(
4050
4331
  summary: "Submit onsite agent member-create results for a claimed command"
4051
4332
  })
4052
4333
  )
4334
+ ).add(
4335
+ HttpApiEndpoint.post(
4336
+ "completeOnsiteAgentEnsureActiveMembership",
4337
+ "/onsite-agent/ensure-active-membership-commands/:commandId/complete"
4338
+ ).setPath(
4339
+ Schema2.Struct({
4340
+ commandId: HttpApiSchema2.param("commandId", Schema2.String)
4341
+ })
4342
+ ).setPayload(OnsiteAgentCompleteEnsureActiveMembershipSchema).addSuccess(EnsureActiveMembershipCommandSchema).annotateContext(
4343
+ OpenApi.annotations({
4344
+ summary: "Submit an Ensure Active Membership terminal outcome"
4345
+ })
4346
+ )
4053
4347
  ).add(
4054
4348
  HttpApiEndpoint.post(
4055
4349
  "completeOnsiteAgentMemberUpdate",
@@ -4181,7 +4475,7 @@ var serviceClientsGroup = HttpApiGroup.make("serviceClients").add(
4181
4475
  })
4182
4476
  )
4183
4477
  );
4184
- var HubApi = HttpApi.make("hub").add(authGroup).add(organizationsGroup).add(membersGroup).add(memberPointsGroup).add(vouchersGroup).add(pointProvidersGroup).add(onsiteCallsGroup).add(memberSourcesGroup).add(onsiteAgentsGroup).add(guestsGroup).add(serviceClientsGroup).prefix("/v1").addError(UnauthorizedErrorSchema).addError(ForbiddenErrorSchema).addError(NotFoundErrorSchema).addError(ConflictErrorSchema).addError(BadRequestErrorSchema).annotateContext(
4478
+ var HubApi = HttpApi.make("hub").add(authGroup).add(organizationsGroup).add(membersGroup).add(memberPointsGroup).add(vouchersGroup).add(pointProvidersGroup).add(onsiteCallsGroup).add(memberSourcesGroup).add(onsiteAgentsGroup).add(guestsGroup).add(serviceClientsGroup).prefix("/v1").addError(UnauthorizedErrorSchema).addError(ForbiddenErrorSchema).addError(NotFoundErrorSchema).addError(ConflictErrorSchema).addError(BadRequestErrorSchema).addError(InternalServerErrorSchema).annotateContext(
4185
4479
  OpenApi.annotations({
4186
4480
  title: "Spoke Hub API",
4187
4481
  version: "1.0.0",
@@ -4435,6 +4729,24 @@ function apiErrorBodyFromUnknown(value) {
4435
4729
  }
4436
4730
  return null;
4437
4731
  }
4732
+ function statusFromApiErrorBody(body) {
4733
+ switch (body.code) {
4734
+ case "bad_request":
4735
+ return 400;
4736
+ case "unauthorized":
4737
+ return 401;
4738
+ case "forbidden":
4739
+ return 403;
4740
+ case "not_found":
4741
+ return 404;
4742
+ case "conflict":
4743
+ return 409;
4744
+ case "internal_error":
4745
+ return 500;
4746
+ default:
4747
+ return void 0;
4748
+ }
4749
+ }
4438
4750
  function errorMessageFromUnknown(value) {
4439
4751
  for (const candidate of errorCandidatesFromUnknown(value)) {
4440
4752
  if (candidate instanceof Error && candidate.message.length > 0) {
@@ -4464,7 +4776,10 @@ function clientErrorFromUnknown(value) {
4464
4776
  const body = apiErrorBodyFromUnknown(value);
4465
4777
  const context = httpContextFromUnknown(value);
4466
4778
  if (body) {
4467
- return new SpokeHubApiError(body, value, context);
4779
+ return new SpokeHubApiError(body, value, {
4780
+ ...context,
4781
+ status: context.status ?? statusFromApiErrorBody(body)
4782
+ });
4468
4783
  }
4469
4784
  const statusCode = context.status ? `http_${context.status}` : void 0;
4470
4785
  return new SpokeHubClientError({
@@ -4568,6 +4883,12 @@ function makeOnsiteResourceClient(client) {
4568
4883
  return {
4569
4884
  call,
4570
4885
  members: {
4886
+ ensureActive: (input) => call({
4887
+ organizationId: input.organizationId,
4888
+ waitMs: input.waitMs,
4889
+ operation: "member.ensure_active",
4890
+ ...input.payload
4891
+ }),
4571
4892
  create: (input) => call({
4572
4893
  organizationId: input.organizationId,
4573
4894
  waitMs: input.waitMs,
@@ -4837,6 +5158,12 @@ function makeSpokeClient(hubClient) {
4837
5158
  )
4838
5159
  },
4839
5160
  sourceRequests: {
5161
+ ensureActive: (input) => unwrap(
5162
+ hubClient.members.ensureActiveMembership({
5163
+ path: { organizationId: input.organizationId },
5164
+ payload: input.payload
5165
+ })
5166
+ ),
4840
5167
  create: (input) => unwrap(
4841
5168
  hubClient.members.requestSourceManagedMemberCreate({
4842
5169
  path: { organizationId: input.organizationId },
@@ -5165,11 +5492,22 @@ export {
5165
5492
  DateOnlySchema,
5166
5493
  DeletePayloadSchema,
5167
5494
  DeleteServiceClientSchema,
5495
+ EnsureActiveMembershipCommandPayloadSchema,
5496
+ EnsureActiveMembershipCommandSchema,
5497
+ EnsureActiveMembershipMemberSchema,
5498
+ EnsureActiveMembershipNonSuccessOutcomeSchema,
5499
+ EnsureActiveMembershipNonSuccessResultSchema,
5500
+ EnsureActiveMembershipOutcomeSchema,
5501
+ EnsureActiveMembershipResponseSchema,
5502
+ EnsureActiveMembershipResultSchema,
5503
+ EnsureActiveMembershipSuccessOutcomeSchema,
5504
+ EnsureActiveMembershipSuccessResultSchema,
5168
5505
  ForbiddenErrorSchema,
5169
5506
  GuestContactMatchSchema,
5170
5507
  GuestSchema,
5171
5508
  HubApi,
5172
5509
  ImportedMemberRecordSchema,
5510
+ InternalServerErrorSchema,
5173
5511
  IssuedPrivateKeySchema,
5174
5512
  MarketingPreferencesSchema,
5175
5513
  MemberBasicResponseSchema,
@@ -5189,6 +5527,7 @@ export {
5189
5527
  NotFoundErrorSchema,
5190
5528
  OnsiteAgentCommandSchema,
5191
5529
  OnsiteAgentCompleteCustomFieldsSchema,
5530
+ OnsiteAgentCompleteEnsureActiveMembershipSchema,
5192
5531
  OnsiteAgentCompleteMemberCreateSchema,
5193
5532
  OnsiteAgentCompleteMemberLookupSchema,
5194
5533
  OnsiteAgentCompleteMemberRenewalSchema,
@@ -5197,6 +5536,8 @@ export {
5197
5536
  OnsiteAgentCompleteRunSchema,
5198
5537
  OnsiteAgentCsvUploadTargetSchema,
5199
5538
  OnsiteAgentCustomFieldsCommandSchema,
5539
+ OnsiteAgentEnsureActiveMembershipCommandSchema,
5540
+ OnsiteAgentEnsureActiveMembershipCompletionResultSchema,
5200
5541
  OnsiteAgentHeartbeatResponseSchema,
5201
5542
  OnsiteAgentHeartbeatSchema,
5202
5543
  OnsiteAgentIngestLiveFbiBatchSchema,
@@ -5209,6 +5550,7 @@ export {
5209
5550
  OnsitePointCommandSchema,
5210
5551
  OnsiteResourceCallRequestSchema,
5211
5552
  OnsiteResourceCallResponseSchema,
5553
+ OnsiteResourceEnsureActiveMembershipCallResponseSchema,
5212
5554
  OnsiteResourceMemberCallResponseSchema,
5213
5555
  OnsiteResourcePointCallResponseSchema,
5214
5556
  OnsiteResourceVoucherCallResponseSchema,
@@ -5264,6 +5606,7 @@ export {
5264
5606
  PaginatedOrganizationsSchema,
5265
5607
  PaginatedServiceClientsSchema,
5266
5608
  PresignedPostSchema,
5609
+ RequestEnsureActiveMembershipSchema,
5267
5610
  RequestPointDebitSchema,
5268
5611
  RequestPointLookupSchema,
5269
5612
  RequestSourceManagedMemberCreateSchema,
@@ -5301,11 +5644,13 @@ export {
5301
5644
  UpsertOrganizationProductWebhookSchema,
5302
5645
  UpsertOrganizationVoucherProviderSchema,
5303
5646
  adminRoles,
5647
+ ensureActiveMembershipOutcomes,
5304
5648
  guestStatuses,
5305
5649
  makeBadRequest,
5306
5650
  makeConflict,
5307
5651
  makeForbidden,
5308
5652
  makeHubApiClient,
5653
+ makeInternalServerError,
5309
5654
  makeNotFound,
5310
5655
  makeOnsiteResourceClient,
5311
5656
  makePromiseHubApiClient,
@@ -5320,6 +5665,7 @@ export {
5320
5665
  memberPreferredContactMethods,
5321
5666
  memberRecordModes,
5322
5667
  memberStatuses,
5668
+ organizationMemberSourceAgentCapabilities,
5323
5669
  organizationMemberSourceAgentStatuses,
5324
5670
  organizationMemberSourceBatchTransports,
5325
5671
  organizationMemberSourceCommandKinds,