@spoketech/hub-client 0.1.15 → 0.1.17

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,90 @@ 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 EnsureActiveMembershipWorkflowStepSchema = Schema2.Literal(
3127
+ "identity_observed",
3128
+ "rate_confirmed",
3129
+ "profile_confirmed",
3130
+ "preferences_confirmed",
3131
+ "renewal_submitted",
3132
+ "membership_verified",
3133
+ "hub_refreshed"
3134
+ );
3135
+ var EnsureActiveMembershipWorkflowStepStateSchema = Schema2.Literal(
3136
+ "pending",
3137
+ "in_progress",
3138
+ "confirmed",
3139
+ "ambiguous",
3140
+ "failed"
3141
+ );
3142
+ var EnsureActiveMembershipWorkflowProgressSchema = Schema2.Struct({
3143
+ revision: Schema2.Number,
3144
+ steps: Schema2.Struct({
3145
+ identity_observed: Schema2.optional(EnsureActiveMembershipWorkflowStepStateSchema),
3146
+ rate_confirmed: Schema2.optional(EnsureActiveMembershipWorkflowStepStateSchema),
3147
+ profile_confirmed: Schema2.optional(EnsureActiveMembershipWorkflowStepStateSchema),
3148
+ preferences_confirmed: Schema2.optional(EnsureActiveMembershipWorkflowStepStateSchema),
3149
+ renewal_submitted: Schema2.optional(EnsureActiveMembershipWorkflowStepStateSchema),
3150
+ membership_verified: Schema2.optional(EnsureActiveMembershipWorkflowStepStateSchema),
3151
+ hub_refreshed: Schema2.optional(EnsureActiveMembershipWorkflowStepStateSchema)
3152
+ })
3153
+ });
3154
+ var OnsiteAgentEnsureActiveMembershipProgressUpdateSchema = Schema2.Struct({
3155
+ expectedRevision: Schema2.Number,
3156
+ steps: EnsureActiveMembershipWorkflowProgressSchema.fields.steps,
3157
+ lastSafeStep: Schema2.optional(EnsureActiveMembershipWorkflowStepSchema)
3158
+ });
3159
+ var RequestEnsureActiveMembershipSchema = Schema2.Struct({
3160
+ idempotencyKey: EnsureActiveMembershipIdempotencyKeySchema,
3161
+ waitMs: OnsiteResourceCallWaitMsSchema,
3162
+ member: EnsureActiveMembershipMemberSchema
3163
+ });
3164
+ var EnsureActiveMembershipCommandSchema = Schema2.Struct({
3165
+ ...OrganizationMemberSourceCommandSchema.fields,
3166
+ kind: Schema2.Literal("ensure_active_membership"),
3167
+ payload: EnsureActiveMembershipCommandPayloadSchema,
3168
+ result: Schema2.Union(EnsureActiveMembershipResultSchema, Schema2.Null)
3169
+ });
3170
+ var EnsureActiveMembershipResponseSchema = Schema2.Struct({
3171
+ settled: Schema2.Boolean,
3172
+ timedOut: Schema2.Boolean,
3173
+ command: EnsureActiveMembershipCommandSchema
3174
+ });
2927
3175
  var RequestSourceManagedMemberUpdateSchema = UpdateMemberSchema;
2928
3176
  var RequestSourceManagedMemberPreferenceUpdateSchema = Schema2.Struct({
2929
3177
  expectedUpdatedAt: TimestampSchema,
@@ -2955,13 +3203,13 @@ var SourceManagedMemberPreferenceUpdateCommandPayloadSchema = Schema2.Struct({
2955
3203
  expectedUpdatedAt: TimestampSchema,
2956
3204
  marketingPreferences: MarketingPreferencesInputSchema
2957
3205
  });
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
3206
  var OnsiteResourceCallRequestSchema = Schema2.Union(
3207
+ Schema2.Struct({
3208
+ operation: Schema2.Literal("member.ensure_active"),
3209
+ waitMs: OnsiteResourceCallWaitMsSchema,
3210
+ idempotencyKey: EnsureActiveMembershipIdempotencyKeySchema,
3211
+ member: EnsureActiveMembershipMemberSchema
3212
+ }),
2965
3213
  Schema2.Struct({
2966
3214
  operation: Schema2.Literal("member.create"),
2967
3215
  waitMs: OnsiteResourceCallWaitMsSchema,
@@ -3022,6 +3270,13 @@ var OnsiteResourceMemberCallResponseSchema = Schema2.Struct({
3022
3270
  timedOut: Schema2.Boolean,
3023
3271
  command: OrganizationMemberSourceCommandSchema
3024
3272
  });
3273
+ var OnsiteResourceEnsureActiveMembershipCallResponseSchema = Schema2.Struct({
3274
+ kind: Schema2.Literal("member"),
3275
+ operation: Schema2.Literal("member.ensure_active"),
3276
+ settled: Schema2.Boolean,
3277
+ timedOut: Schema2.Boolean,
3278
+ command: EnsureActiveMembershipCommandSchema
3279
+ });
3025
3280
  var OnsiteResourceVoucherCallResponseSchema = Schema2.Struct({
3026
3281
  kind: Schema2.Literal("voucher"),
3027
3282
  operation: Schema2.Literal("voucher.issue", "voucher.lookup"),
@@ -3037,6 +3292,7 @@ var OnsiteResourcePointCallResponseSchema = Schema2.Struct({
3037
3292
  command: OrganizationPointCommandSchema
3038
3293
  });
3039
3294
  var OnsiteResourceCallResponseSchema = Schema2.Union(
3295
+ OnsiteResourceEnsureActiveMembershipCallResponseSchema,
3040
3296
  OnsiteResourceMemberCallResponseSchema,
3041
3297
  OnsiteResourceVoucherCallResponseSchema,
3042
3298
  OnsiteResourcePointCallResponseSchema
@@ -3163,6 +3419,18 @@ var OnsiteAgentMemberCreateCommandSchema = Schema2.Struct({
3163
3419
  config: JsonObjectSchema,
3164
3420
  secrets: Schema2.Array(OrganizationMemberSourceSecretInputSchema)
3165
3421
  });
3422
+ var OnsiteAgentEnsureActiveMembershipCommandSchema = Schema2.Struct({
3423
+ commandId: Schema2.String,
3424
+ organizationId: Schema2.String,
3425
+ organizationMemberSourceId: Schema2.String,
3426
+ vendor: Schema2.Literal("odyssey_gaming"),
3427
+ connectorType: Schema2.Literal("odyssey_gaming"),
3428
+ requestedAt: TimestampSchema,
3429
+ payload: EnsureActiveMembershipCommandPayloadSchema,
3430
+ workflow: EnsureActiveMembershipWorkflowProgressSchema,
3431
+ config: JsonObjectSchema,
3432
+ secrets: Schema2.Array(OrganizationMemberSourceSecretInputSchema)
3433
+ });
3166
3434
  var OnsiteAgentMemberUpdateCommandSchema = Schema2.Struct({
3167
3435
  commandId: Schema2.String,
3168
3436
  organizationId: Schema2.String,
@@ -3221,6 +3489,9 @@ var OnsiteAgentCustomFieldsCommandSchema = Schema2.Struct({
3221
3489
  var OnsiteAgentHeartbeatSchema = Schema2.Struct({
3222
3490
  version: Schema2.String,
3223
3491
  pollingIntervalSeconds: Schema2.optional(Schema2.Number),
3492
+ capabilities: Schema2.optional(
3493
+ Schema2.Array(Schema2.Literal(...organizationMemberSourceAgentCapabilities))
3494
+ ),
3224
3495
  metadata: Schema2.optional(JsonObjectSchema),
3225
3496
  lastError: OptionalNullableString
3226
3497
  });
@@ -3279,6 +3550,31 @@ var OnsiteAgentCompleteMemberCreateSchema = Schema2.Struct({
3279
3550
  record: Schema2.optional(ImportedMemberRecordSchema),
3280
3551
  contactPreferences: Schema2.optional(Schema2.Array(SourceContactPreferenceSchema)),
3281
3552
  creationResult: Schema2.optional(OnsiteAgentMemberCreationResultSchema),
3553
+ ensureOutcome: Schema2.optional(EnsureActiveMembershipOutcomeSchema),
3554
+ errorMessage: OptionalNullableString
3555
+ });
3556
+ var OnsiteAgentEnsureActiveMembershipRecordSchema = Schema2.Struct({
3557
+ ...ImportedMemberRecordSchema.fields,
3558
+ sourceStatus: Schema2.Literal("ACTIVE"),
3559
+ membershipTypeId: Schema2.String,
3560
+ expiresAt: TimestampSchema
3561
+ });
3562
+ var OnsiteAgentEnsureActiveMembershipCreatedResultSchema = Schema2.Struct({
3563
+ outcome: Schema2.Literal("created"),
3564
+ record: OnsiteAgentEnsureActiveMembershipRecordSchema,
3565
+ creationResult: Schema2.Literal("created", "recovered_create")
3566
+ });
3567
+ var OnsiteAgentEnsureActiveMembershipExistingResultSchema = Schema2.Struct({
3568
+ outcome: Schema2.Literal("matched_active", "renewed_existing"),
3569
+ record: OnsiteAgentEnsureActiveMembershipRecordSchema
3570
+ });
3571
+ var OnsiteAgentEnsureActiveMembershipCompletionResultSchema = Schema2.Union(
3572
+ OnsiteAgentEnsureActiveMembershipCreatedResultSchema,
3573
+ OnsiteAgentEnsureActiveMembershipExistingResultSchema,
3574
+ EnsureActiveMembershipNonSuccessResultSchema
3575
+ );
3576
+ var OnsiteAgentCompleteEnsureActiveMembershipSchema = Schema2.Struct({
3577
+ result: Schema2.optional(OnsiteAgentEnsureActiveMembershipCompletionResultSchema),
3282
3578
  errorMessage: OptionalNullableString
3283
3579
  });
3284
3580
  var OnsiteAgentCompleteMemberUpdateSchema = Schema2.Struct({
@@ -3577,6 +3873,16 @@ var membersGroup = HttpApiGroup.make("members").add(
3577
3873
  transform: sourceManagedCreateExamplesTransform
3578
3874
  })
3579
3875
  )
3876
+ ).add(
3877
+ HttpApiEndpoint.post(
3878
+ "ensureActiveMembership",
3879
+ "/organizations/:organizationId/members/ensure-active"
3880
+ ).setPath(OrganizationIdParams).setPayload(RequestEnsureActiveMembershipSchema).addSuccess(EnsureActiveMembershipResponseSchema, { status: 202 }).annotateContext(
3881
+ OpenApi.annotations({
3882
+ summary: "Ensure an Odyssey membership is active",
3883
+ transform: ensureActiveMembershipExamplesTransform
3884
+ })
3885
+ )
3580
3886
  ).add(
3581
3887
  HttpApiEndpoint.post(
3582
3888
  "requestSourceManagedMemberRenewal",
@@ -3982,6 +4288,15 @@ var onsiteAgentsGroup = HttpApiGroup.make("onsiteAgents").add(
3982
4288
  HttpApiEndpoint.post("pollOnsiteAgentMemberCreateCommand", "/onsite-agent/member-commands/poll").addSuccess(Schema2.Union(OnsiteAgentMemberCreateCommandSchema, Schema2.Null)).annotateContext(
3983
4289
  OpenApi.annotations({ summary: "Poll for the next pending onsite member-create command" })
3984
4290
  )
4291
+ ).add(
4292
+ HttpApiEndpoint.post(
4293
+ "pollOnsiteAgentEnsureActiveMembershipCommand",
4294
+ "/onsite-agent/ensure-active-membership-commands/poll"
4295
+ ).addSuccess(Schema2.Union(OnsiteAgentEnsureActiveMembershipCommandSchema, Schema2.Null)).annotateContext(
4296
+ OpenApi.annotations({
4297
+ summary: "Poll for the next Ensure Active Membership command"
4298
+ })
4299
+ )
3985
4300
  ).add(
3986
4301
  HttpApiEndpoint.post(
3987
4302
  "pollOnsiteAgentMemberUpdateCommand",
@@ -4050,6 +4365,45 @@ var onsiteAgentsGroup = HttpApiGroup.make("onsiteAgents").add(
4050
4365
  summary: "Submit onsite agent member-create results for a claimed command"
4051
4366
  })
4052
4367
  )
4368
+ ).add(
4369
+ HttpApiEndpoint.post(
4370
+ "completeOnsiteAgentEnsureActiveMembership",
4371
+ "/onsite-agent/ensure-active-membership-commands/:commandId/complete"
4372
+ ).setPath(
4373
+ Schema2.Struct({
4374
+ commandId: HttpApiSchema2.param("commandId", Schema2.String)
4375
+ })
4376
+ ).setPayload(OnsiteAgentCompleteEnsureActiveMembershipSchema).addSuccess(EnsureActiveMembershipCommandSchema).annotateContext(
4377
+ OpenApi.annotations({
4378
+ summary: "Submit an Ensure Active Membership terminal outcome"
4379
+ })
4380
+ )
4381
+ ).add(
4382
+ HttpApiEndpoint.post(
4383
+ "heartbeatOnsiteAgentEnsureActiveMembership",
4384
+ "/onsite-agent/ensure-active-membership-commands/:commandId/heartbeat"
4385
+ ).setPath(
4386
+ Schema2.Struct({
4387
+ commandId: HttpApiSchema2.param("commandId", Schema2.String)
4388
+ })
4389
+ ).addSuccess(EnsureActiveMembershipCommandSchema).annotateContext(
4390
+ OpenApi.annotations({
4391
+ summary: "Renew and verify an Ensure Active Membership identity lease"
4392
+ })
4393
+ )
4394
+ ).add(
4395
+ HttpApiEndpoint.post(
4396
+ "recordOnsiteAgentEnsureActiveMembershipProgress",
4397
+ "/onsite-agent/ensure-active-membership-commands/:commandId/progress"
4398
+ ).setPath(
4399
+ Schema2.Struct({
4400
+ commandId: HttpApiSchema2.param("commandId", Schema2.String)
4401
+ })
4402
+ ).setPayload(OnsiteAgentEnsureActiveMembershipProgressUpdateSchema).addSuccess(EnsureActiveMembershipWorkflowProgressSchema).annotateContext(
4403
+ OpenApi.annotations({
4404
+ summary: "Persist durable Ensure Active Membership workflow progress"
4405
+ })
4406
+ )
4053
4407
  ).add(
4054
4408
  HttpApiEndpoint.post(
4055
4409
  "completeOnsiteAgentMemberUpdate",
@@ -4181,7 +4535,7 @@ var serviceClientsGroup = HttpApiGroup.make("serviceClients").add(
4181
4535
  })
4182
4536
  )
4183
4537
  );
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(
4538
+ 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
4539
  OpenApi.annotations({
4186
4540
  title: "Spoke Hub API",
4187
4541
  version: "1.0.0",
@@ -4435,6 +4789,24 @@ function apiErrorBodyFromUnknown(value) {
4435
4789
  }
4436
4790
  return null;
4437
4791
  }
4792
+ function statusFromApiErrorBody(body) {
4793
+ switch (body.code) {
4794
+ case "bad_request":
4795
+ return 400;
4796
+ case "unauthorized":
4797
+ return 401;
4798
+ case "forbidden":
4799
+ return 403;
4800
+ case "not_found":
4801
+ return 404;
4802
+ case "conflict":
4803
+ return 409;
4804
+ case "internal_error":
4805
+ return 500;
4806
+ default:
4807
+ return void 0;
4808
+ }
4809
+ }
4438
4810
  function errorMessageFromUnknown(value) {
4439
4811
  for (const candidate of errorCandidatesFromUnknown(value)) {
4440
4812
  if (candidate instanceof Error && candidate.message.length > 0) {
@@ -4464,7 +4836,10 @@ function clientErrorFromUnknown(value) {
4464
4836
  const body = apiErrorBodyFromUnknown(value);
4465
4837
  const context = httpContextFromUnknown(value);
4466
4838
  if (body) {
4467
- return new SpokeHubApiError(body, value, context);
4839
+ return new SpokeHubApiError(body, value, {
4840
+ ...context,
4841
+ status: context.status ?? statusFromApiErrorBody(body)
4842
+ });
4468
4843
  }
4469
4844
  const statusCode = context.status ? `http_${context.status}` : void 0;
4470
4845
  return new SpokeHubClientError({
@@ -4568,6 +4943,12 @@ function makeOnsiteResourceClient(client) {
4568
4943
  return {
4569
4944
  call,
4570
4945
  members: {
4946
+ ensureActive: (input) => call({
4947
+ organizationId: input.organizationId,
4948
+ waitMs: input.waitMs,
4949
+ operation: "member.ensure_active",
4950
+ ...input.payload
4951
+ }),
4571
4952
  create: (input) => call({
4572
4953
  organizationId: input.organizationId,
4573
4954
  waitMs: input.waitMs,
@@ -4837,6 +5218,12 @@ function makeSpokeClient(hubClient) {
4837
5218
  )
4838
5219
  },
4839
5220
  sourceRequests: {
5221
+ ensureActive: (input) => unwrap(
5222
+ hubClient.members.ensureActiveMembership({
5223
+ path: { organizationId: input.organizationId },
5224
+ payload: input.payload
5225
+ })
5226
+ ),
4840
5227
  create: (input) => unwrap(
4841
5228
  hubClient.members.requestSourceManagedMemberCreate({
4842
5229
  path: { organizationId: input.organizationId },
@@ -5165,11 +5552,25 @@ export {
5165
5552
  DateOnlySchema,
5166
5553
  DeletePayloadSchema,
5167
5554
  DeleteServiceClientSchema,
5555
+ EnsureActiveMembershipCommandPayloadSchema,
5556
+ EnsureActiveMembershipCommandSchema,
5557
+ EnsureActiveMembershipMemberSchema,
5558
+ EnsureActiveMembershipNonSuccessOutcomeSchema,
5559
+ EnsureActiveMembershipNonSuccessResultSchema,
5560
+ EnsureActiveMembershipOutcomeSchema,
5561
+ EnsureActiveMembershipResponseSchema,
5562
+ EnsureActiveMembershipResultSchema,
5563
+ EnsureActiveMembershipSuccessOutcomeSchema,
5564
+ EnsureActiveMembershipSuccessResultSchema,
5565
+ EnsureActiveMembershipWorkflowProgressSchema,
5566
+ EnsureActiveMembershipWorkflowStepSchema,
5567
+ EnsureActiveMembershipWorkflowStepStateSchema,
5168
5568
  ForbiddenErrorSchema,
5169
5569
  GuestContactMatchSchema,
5170
5570
  GuestSchema,
5171
5571
  HubApi,
5172
5572
  ImportedMemberRecordSchema,
5573
+ InternalServerErrorSchema,
5173
5574
  IssuedPrivateKeySchema,
5174
5575
  MarketingPreferencesSchema,
5175
5576
  MemberBasicResponseSchema,
@@ -5189,6 +5590,7 @@ export {
5189
5590
  NotFoundErrorSchema,
5190
5591
  OnsiteAgentCommandSchema,
5191
5592
  OnsiteAgentCompleteCustomFieldsSchema,
5593
+ OnsiteAgentCompleteEnsureActiveMembershipSchema,
5192
5594
  OnsiteAgentCompleteMemberCreateSchema,
5193
5595
  OnsiteAgentCompleteMemberLookupSchema,
5194
5596
  OnsiteAgentCompleteMemberRenewalSchema,
@@ -5197,6 +5599,9 @@ export {
5197
5599
  OnsiteAgentCompleteRunSchema,
5198
5600
  OnsiteAgentCsvUploadTargetSchema,
5199
5601
  OnsiteAgentCustomFieldsCommandSchema,
5602
+ OnsiteAgentEnsureActiveMembershipCommandSchema,
5603
+ OnsiteAgentEnsureActiveMembershipCompletionResultSchema,
5604
+ OnsiteAgentEnsureActiveMembershipProgressUpdateSchema,
5200
5605
  OnsiteAgentHeartbeatResponseSchema,
5201
5606
  OnsiteAgentHeartbeatSchema,
5202
5607
  OnsiteAgentIngestLiveFbiBatchSchema,
@@ -5209,6 +5614,7 @@ export {
5209
5614
  OnsitePointCommandSchema,
5210
5615
  OnsiteResourceCallRequestSchema,
5211
5616
  OnsiteResourceCallResponseSchema,
5617
+ OnsiteResourceEnsureActiveMembershipCallResponseSchema,
5212
5618
  OnsiteResourceMemberCallResponseSchema,
5213
5619
  OnsiteResourcePointCallResponseSchema,
5214
5620
  OnsiteResourceVoucherCallResponseSchema,
@@ -5264,6 +5670,7 @@ export {
5264
5670
  PaginatedOrganizationsSchema,
5265
5671
  PaginatedServiceClientsSchema,
5266
5672
  PresignedPostSchema,
5673
+ RequestEnsureActiveMembershipSchema,
5267
5674
  RequestPointDebitSchema,
5268
5675
  RequestPointLookupSchema,
5269
5676
  RequestSourceManagedMemberCreateSchema,
@@ -5301,11 +5708,13 @@ export {
5301
5708
  UpsertOrganizationProductWebhookSchema,
5302
5709
  UpsertOrganizationVoucherProviderSchema,
5303
5710
  adminRoles,
5711
+ ensureActiveMembershipOutcomes,
5304
5712
  guestStatuses,
5305
5713
  makeBadRequest,
5306
5714
  makeConflict,
5307
5715
  makeForbidden,
5308
5716
  makeHubApiClient,
5717
+ makeInternalServerError,
5309
5718
  makeNotFound,
5310
5719
  makeOnsiteResourceClient,
5311
5720
  makePromiseHubApiClient,
@@ -5320,6 +5729,7 @@ export {
5320
5729
  memberPreferredContactMethods,
5321
5730
  memberRecordModes,
5322
5731
  memberStatuses,
5732
+ organizationMemberSourceAgentCapabilities,
5323
5733
  organizationMemberSourceAgentStatuses,
5324
5734
  organizationMemberSourceBatchTransports,
5325
5735
  organizationMemberSourceCommandKinds,