@spoketech/hub-client 0.1.17 → 0.1.19

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
@@ -28,7 +28,7 @@ var memberCreatedOrigins = [
28
28
  "source_create"
29
29
  ];
30
30
  var guestStatuses = ["active", "checked_out", "archived"];
31
- var adminRoles = ["platform_admin", "org_admin", "auditor"];
31
+ var adminRoles = ["platform_admin", "org_admin", "auditor", "workflow_resolver"];
32
32
  var organizationMemberSourceVendors = [
33
33
  "max_gaming",
34
34
  "odyssey_gaming",
@@ -124,6 +124,7 @@ var organizationMemberSourceCsvImportStatuses = [
124
124
  ];
125
125
 
126
126
  // ../contracts/src/contracts.ts
127
+ import * as Either from "effect/Either";
127
128
  import * as Schema2 from "effect/Schema";
128
129
 
129
130
  // ../contracts/src/errors.ts
@@ -604,6 +605,7 @@ var MemberSchema = Schema2.Struct({
604
605
  });
605
606
  var MemberResponseModeSchema = Schema2.Literal("full", "med", "basic");
606
607
  var OrganizationMembersStatusFilterSchema = Schema2.Literal(
608
+ "notArchived",
607
609
  "active",
608
610
  "suspended",
609
611
  "expired"
@@ -643,14 +645,16 @@ var MemberMedSchema = Schema2.Struct({
643
645
  customFields: JsonObjectSchema,
644
646
  updatedAt: TimestampSchema
645
647
  });
646
- var MemberBasicSchema = Schema2.Struct({
648
+ var MemberBasicFields = {
647
649
  id: Schema2.String,
650
+ status: Schema2.Literal(...memberComputedStatuses),
648
651
  displayName: Schema2.String,
649
652
  dob: Schema2.Union(DateOnlySchema, Schema2.Null),
650
653
  ...SourceMembershipObservationFields,
651
654
  statusCredits: Schema2.Number,
652
655
  memberNumber: NullableString
653
- });
656
+ };
657
+ var MemberBasicSchema = Schema2.Struct(MemberBasicFields);
654
658
  var MemberFullResponseSchema = Schema2.Struct({
655
659
  id: Schema2.String,
656
660
  organizationId: Schema2.String,
@@ -730,12 +734,7 @@ var MemberMedResponseSchema = Schema2.Struct({
730
734
  responseMode: Schema2.Literal("med")
731
735
  });
732
736
  var MemberBasicResponseSchema = Schema2.Struct({
733
- id: Schema2.String,
734
- displayName: Schema2.String,
735
- dob: Schema2.Union(DateOnlySchema, Schema2.Null),
736
- ...SourceMembershipObservationFields,
737
- statusCredits: Schema2.Number,
738
- memberNumber: NullableString,
737
+ ...MemberBasicFields,
739
738
  responseMode: Schema2.Literal("basic")
740
739
  });
741
740
  var MemberResponseSchema = Schema2.Union(
@@ -848,7 +847,7 @@ var OrganizationMembersListUrlParamsSchema = Schema2.Struct({
848
847
  ),
849
848
  memberStatus: Schema2.optional(
850
849
  OrganizationMembersStatusFilterSchema.annotations({
851
- description: "Computed member status filter. `active` excludes suspended members and members expired beyond the organization's grace period, `suspended` returns suspended active members, and `expired` returns active members whose expiry date is beyond the grace period.",
850
+ description: "Computed member status filter. `notArchived` returns every non-archived member, `active` excludes suspended members and members expired beyond the organization's grace period, `suspended` returns suspended active members, and `expired` returns active members whose expiry date is beyond the grace period.",
852
851
  example: "active"
853
852
  })
854
853
  ),
@@ -2570,6 +2569,15 @@ var OrganizationMemberSourceAgentSchema = Schema2.Struct({
2570
2569
  updatedAt: TimestampSchema,
2571
2570
  deletedAt: Schema2.Union(TimestampSchema, Schema2.Null)
2572
2571
  });
2572
+ var OrganizationMemberSourceEnsureActiveMembershipConfigSchema = Schema2.Struct({
2573
+ ensureActiveMembershipEnabled: Schema2.optional(Schema2.Boolean)
2574
+ }).pipe(Schema2.extend(JsonObjectSchema));
2575
+ function memberSourceEnsureActiveMembershipEnabled(config) {
2576
+ const decoded = Schema2.decodeUnknownEither(
2577
+ OrganizationMemberSourceEnsureActiveMembershipConfigSchema
2578
+ )(config);
2579
+ return Either.isRight(decoded) && decoded.right.ensureActiveMembershipEnabled === true;
2580
+ }
2573
2581
  var OrganizationMemberSourceSchema = Schema2.Struct({
2574
2582
  id: Schema2.String,
2575
2583
  organizationId: Schema2.String,
@@ -2588,7 +2596,7 @@ var OrganizationMemberSourceSchema = Schema2.Struct({
2588
2596
  ),
2589
2597
  status: Schema2.Literal(...organizationMemberSourceStatuses),
2590
2598
  syncSchedule: NullableString,
2591
- config: JsonObjectSchema,
2599
+ config: OrganizationMemberSourceEnsureActiveMembershipConfigSchema,
2592
2600
  secretNames: Schema2.Array(MemberSourceSecretNameSchema),
2593
2601
  lastCursor: Schema2.Union(JsonObjectSchema, Schema2.Null),
2594
2602
  lastSuccessfulSyncAt: Schema2.Union(TimestampSchema, Schema2.Null),
@@ -3061,7 +3069,7 @@ var UpsertOrganizationMemberSourceSchema = Schema2.Struct({
3061
3069
  ),
3062
3070
  status: Schema2.optional(Schema2.Literal(...organizationMemberSourceStatuses)),
3063
3071
  syncSchedule: OptionalNullableString,
3064
- config: JsonObjectSchema,
3072
+ config: OrganizationMemberSourceEnsureActiveMembershipConfigSchema,
3065
3073
  secrets: Schema2.optional(Schema2.Array(OrganizationMemberSourceSecretInputSchema))
3066
3074
  });
3067
3075
  var ConvertOrganizationToDemoSchema = Schema2.Struct({
@@ -3119,9 +3127,43 @@ var EnsureActiveMembershipIdempotencyKeySchema = Schema2.String.pipe(
3119
3127
  description: "Caller-provided key used to replay this operation safely.",
3120
3128
  example: "venue-join-123"
3121
3129
  });
3130
+ var EnsureActiveMembershipResolutionActionSchema = Schema2.Literal(
3131
+ "reconcile",
3132
+ "authorize_renewal"
3133
+ );
3134
+ var EnsureActiveMembershipReviewCommandIdSchema = Schema2.String.pipe(
3135
+ Schema2.nonEmptyString(),
3136
+ Schema2.maxLength(36)
3137
+ );
3138
+ var EnsureActiveMembershipOperatorActorIdSchema = Schema2.String.pipe(
3139
+ Schema2.nonEmptyString(),
3140
+ Schema2.maxLength(36)
3141
+ );
3142
+ var EnsureActiveMembershipOperatorReasonSchema = Schema2.String.pipe(
3143
+ Schema2.filter((value) => value.trim().length > 0 && value.trim().length <= 500, {
3144
+ message: () => "Operator reason must be between 1 and 500 characters"
3145
+ })
3146
+ );
3122
3147
  var EnsureActiveMembershipCommandPayloadSchema = Schema2.Struct({
3123
3148
  idempotencyKey: EnsureActiveMembershipIdempotencyKeySchema,
3124
- member: EnsureActiveMembershipMemberSchema
3149
+ member: EnsureActiveMembershipMemberSchema,
3150
+ continuation: Schema2.optional(
3151
+ Schema2.Union(
3152
+ Schema2.Struct({
3153
+ action: Schema2.Literal("reconcile"),
3154
+ reviewCommandId: EnsureActiveMembershipReviewCommandIdSchema,
3155
+ requestedByActorId: EnsureActiveMembershipOperatorActorIdSchema,
3156
+ reason: Schema2.optional(EnsureActiveMembershipOperatorReasonSchema)
3157
+ }),
3158
+ Schema2.Struct({
3159
+ action: Schema2.Literal("authorize_renewal"),
3160
+ reviewCommandId: EnsureActiveMembershipReviewCommandIdSchema,
3161
+ requestedByActorId: EnsureActiveMembershipOperatorActorIdSchema,
3162
+ reason: EnsureActiveMembershipOperatorReasonSchema,
3163
+ confirmedNotRenewed: Schema2.Literal(true)
3164
+ })
3165
+ )
3166
+ )
3125
3167
  });
3126
3168
  var EnsureActiveMembershipWorkflowStepSchema = Schema2.Literal(
3127
3169
  "identity_observed",
@@ -3151,16 +3193,72 @@ var EnsureActiveMembershipWorkflowProgressSchema = Schema2.Struct({
3151
3193
  hub_refreshed: Schema2.optional(EnsureActiveMembershipWorkflowStepStateSchema)
3152
3194
  })
3153
3195
  });
3196
+ var EnsureActiveMembershipAuditTimestampSchema = Schema2.String.pipe(
3197
+ Schema2.filter((value) => !Number.isNaN(new Date(value).valueOf()), {
3198
+ message: () => "Expected a valid timestamp"
3199
+ })
3200
+ );
3201
+ var OnsiteAgentEnsureActiveMembershipAuditEventSchema = Schema2.Struct({
3202
+ step: EnsureActiveMembershipWorkflowStepSchema,
3203
+ outcome: EnsureActiveMembershipWorkflowStepStateSchema,
3204
+ reasonCode: Schema2.optional(Schema2.String.pipe(Schema2.pattern(/^[a-z0-9_:-]{1,96}$/))),
3205
+ sourceStatus: Schema2.optional(Schema2.String.pipe(Schema2.pattern(/^[A-Z0-9 _-]{1,96}$/))),
3206
+ membershipTypeId: Schema2.optional(Schema2.String.pipe(Schema2.pattern(/^[A-Za-z0-9._:-]{1,64}$/))),
3207
+ membershipExpiry: Schema2.optional(EnsureActiveMembershipAuditTimestampSchema),
3208
+ providerFee: Schema2.optional(Schema2.Finite),
3209
+ providerRestricted: Schema2.optional(Schema2.Boolean),
3210
+ appliedChanges: Schema2.optional(
3211
+ Schema2.Array(Schema2.Literal("rate", "profile", "preferences", "renewal"))
3212
+ ),
3213
+ resolutionAction: Schema2.optional(EnsureActiveMembershipResolutionActionSchema),
3214
+ reviewCommandId: Schema2.optional(EnsureActiveMembershipReviewCommandIdSchema),
3215
+ operatorActorId: Schema2.optional(EnsureActiveMembershipOperatorActorIdSchema),
3216
+ operatorReason: Schema2.optional(EnsureActiveMembershipOperatorReasonSchema),
3217
+ operatorConfirmedNotRenewed: Schema2.optional(Schema2.Literal(true))
3218
+ });
3154
3219
  var OnsiteAgentEnsureActiveMembershipProgressUpdateSchema = Schema2.Struct({
3155
3220
  expectedRevision: Schema2.Number,
3156
3221
  steps: EnsureActiveMembershipWorkflowProgressSchema.fields.steps,
3157
- lastSafeStep: Schema2.optional(EnsureActiveMembershipWorkflowStepSchema)
3222
+ lastSafeStep: Schema2.optional(EnsureActiveMembershipWorkflowStepSchema),
3223
+ auditEvents: Schema2.optional(Schema2.Array(OnsiteAgentEnsureActiveMembershipAuditEventSchema))
3158
3224
  });
3159
3225
  var RequestEnsureActiveMembershipSchema = Schema2.Struct({
3160
3226
  idempotencyKey: EnsureActiveMembershipIdempotencyKeySchema,
3161
3227
  waitMs: OnsiteResourceCallWaitMsSchema,
3162
3228
  member: EnsureActiveMembershipMemberSchema
3163
3229
  });
3230
+ var EnsureActiveMembershipManualReviewItemSchema = Schema2.Struct({
3231
+ workflowId: Schema2.String,
3232
+ commandId: Schema2.String,
3233
+ organizationId: Schema2.String,
3234
+ source: Schema2.Struct({
3235
+ id: Schema2.String,
3236
+ vendor: Schema2.Literal("odyssey_gaming")
3237
+ }),
3238
+ outcome: EnsureActiveMembershipNonSuccessOutcomeSchema,
3239
+ resolutionPath: Schema2.Literal("reconcile", "correct_in_odyssey"),
3240
+ renewalAuthorizationAvailable: Schema2.Boolean,
3241
+ lastSafeStep: Schema2.Union(EnsureActiveMembershipWorkflowStepSchema, Schema2.Null),
3242
+ reasonCode: Schema2.String,
3243
+ ageMs: Schema2.Number,
3244
+ startedAt: TimestampSchema,
3245
+ updatedAt: TimestampSchema,
3246
+ member: Schema2.Struct({
3247
+ firstName: Schema2.String,
3248
+ lastName: Schema2.String,
3249
+ dob: DateOnlySchema,
3250
+ membershipTypeId: Schema2.String
3251
+ })
3252
+ });
3253
+ var EnsureActiveMembershipManualReviewQueueSchema = Schema2.Struct({
3254
+ items: Schema2.Array(EnsureActiveMembershipManualReviewItemSchema),
3255
+ total: Schema2.Number
3256
+ });
3257
+ var ReconcileEnsureActiveMembershipManualReviewSchema = Schema2.Struct({});
3258
+ var AuthorizeEnsureActiveMembershipRenewalSchema = Schema2.Struct({
3259
+ reason: EnsureActiveMembershipOperatorReasonSchema,
3260
+ confirmedNotRenewed: Schema2.Literal(true)
3261
+ });
3164
3262
  var EnsureActiveMembershipCommandSchema = Schema2.Struct({
3165
3263
  ...OrganizationMemberSourceCommandSchema.fields,
3166
3264
  kind: Schema2.Literal("ensure_active_membership"),
@@ -3423,6 +3521,7 @@ var OnsiteAgentEnsureActiveMembershipCommandSchema = Schema2.Struct({
3423
3521
  commandId: Schema2.String,
3424
3522
  organizationId: Schema2.String,
3425
3523
  organizationMemberSourceId: Schema2.String,
3524
+ candidateSourceMemberId: Schema2.optional(Schema2.String),
3426
3525
  vendor: Schema2.Literal("odyssey_gaming"),
3427
3526
  connectorType: Schema2.Literal("odyssey_gaming"),
3428
3527
  requestedAt: TimestampSchema,
@@ -4262,6 +4361,29 @@ var memberSourcesGroup = HttpApiGroup.make("memberSources").add(
4262
4361
  summary: "Get a specific member-source command for an organization"
4263
4362
  })
4264
4363
  )
4364
+ ).add(
4365
+ HttpApiEndpoint.get(
4366
+ "listEnsureActiveMembershipManualReviews",
4367
+ "/organizations/:organizationId/member-source/manual-reviews"
4368
+ ).setPath(OrganizationIdParams).addSuccess(EnsureActiveMembershipManualReviewQueueSchema).annotateContext(
4369
+ OpenApi.annotations({ summary: "List unresolved Ensure Active Membership reviews" })
4370
+ )
4371
+ ).add(
4372
+ HttpApiEndpoint.post(
4373
+ "reconcileEnsureActiveMembershipManualReview",
4374
+ "/organizations/:organizationId/member-source/manual-reviews/:commandId/reconcile"
4375
+ ).setPath(OrganizationMemberSourceCommandParams).setPayload(ReconcileEnsureActiveMembershipManualReviewSchema).addSuccess(EnsureActiveMembershipCommandSchema, { status: 202 }).annotateContext(
4376
+ OpenApi.annotations({ summary: "Read Nexus state for a manual-review workflow" })
4377
+ )
4378
+ ).add(
4379
+ HttpApiEndpoint.post(
4380
+ "authorizeEnsureActiveMembershipRenewal",
4381
+ "/organizations/:organizationId/member-source/manual-reviews/:commandId/authorize-renewal"
4382
+ ).setPath(OrganizationMemberSourceCommandParams).setPayload(AuthorizeEnsureActiveMembershipRenewalSchema).addSuccess(EnsureActiveMembershipCommandSchema, { status: 202 }).annotateContext(
4383
+ OpenApi.annotations({
4384
+ summary: "Authorize one audited renewal after inconclusive reconciliation"
4385
+ })
4386
+ )
4265
4387
  ).add(
4266
4388
  HttpApiEndpoint.post(
4267
4389
  "triggerOrganizationMemberSync",
@@ -5527,6 +5649,7 @@ var makePromiseSpokeClient = async (options) => {
5527
5649
  export {
5528
5650
  AddressSchema,
5529
5651
  AdminSessionSchema,
5652
+ AuthorizeEnsureActiveMembershipRenewalSchema,
5530
5653
  BadRequestErrorSchema,
5531
5654
  BootstrapOrganizationMemberSourceAgentResponseSchema,
5532
5655
  BootstrapOrganizationMemberSourceAgentSchema,
@@ -5554,6 +5677,8 @@ export {
5554
5677
  DeleteServiceClientSchema,
5555
5678
  EnsureActiveMembershipCommandPayloadSchema,
5556
5679
  EnsureActiveMembershipCommandSchema,
5680
+ EnsureActiveMembershipManualReviewItemSchema,
5681
+ EnsureActiveMembershipManualReviewQueueSchema,
5557
5682
  EnsureActiveMembershipMemberSchema,
5558
5683
  EnsureActiveMembershipNonSuccessOutcomeSchema,
5559
5684
  EnsureActiveMembershipNonSuccessResultSchema,
@@ -5599,6 +5724,7 @@ export {
5599
5724
  OnsiteAgentCompleteRunSchema,
5600
5725
  OnsiteAgentCsvUploadTargetSchema,
5601
5726
  OnsiteAgentCustomFieldsCommandSchema,
5727
+ OnsiteAgentEnsureActiveMembershipAuditEventSchema,
5602
5728
  OnsiteAgentEnsureActiveMembershipCommandSchema,
5603
5729
  OnsiteAgentEnsureActiveMembershipCompletionResultSchema,
5604
5730
  OnsiteAgentEnsureActiveMembershipProgressUpdateSchema,
@@ -5626,6 +5752,7 @@ export {
5626
5752
  OrganizationMemberSourceCommandSchema,
5627
5753
  OrganizationMemberSourceCsvImportSchema,
5628
5754
  OrganizationMemberSourceCsvMappingSchema,
5755
+ OrganizationMemberSourceEnsureActiveMembershipConfigSchema,
5629
5756
  OrganizationMemberSourceSchema,
5630
5757
  OrganizationMemberSourceSecretInputSchema,
5631
5758
  OrganizationMemberSourceWebhookSchema,
@@ -5670,6 +5797,7 @@ export {
5670
5797
  PaginatedOrganizationsSchema,
5671
5798
  PaginatedServiceClientsSchema,
5672
5799
  PresignedPostSchema,
5800
+ ReconcileEnsureActiveMembershipManualReviewSchema,
5673
5801
  RequestEnsureActiveMembershipSchema,
5674
5802
  RequestPointDebitSchema,
5675
5803
  RequestPointLookupSchema,
@@ -5728,6 +5856,7 @@ export {
5728
5856
  memberCreatedOrigins,
5729
5857
  memberPreferredContactMethods,
5730
5858
  memberRecordModes,
5859
+ memberSourceEnsureActiveMembershipEnabled,
5731
5860
  memberStatuses,
5732
5861
  organizationMemberSourceAgentCapabilities,
5733
5862
  organizationMemberSourceAgentStatuses,