@spoketech/hub-client 0.1.8 → 0.1.10
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/README.md +27 -3
- package/dist/index.d.ts +11818 -7423
- package/dist/index.js +425 -58
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53,6 +53,21 @@ var organizationVoucherCommandStatuses = [
|
|
|
53
53
|
"completed",
|
|
54
54
|
"failed"
|
|
55
55
|
];
|
|
56
|
+
var organizationPointProviderProviders = ["ebet_pos"];
|
|
57
|
+
var organizationPointProviderTransports = ["onsite_client"];
|
|
58
|
+
var organizationPointProviderStatuses = ["active", "disabled"];
|
|
59
|
+
var organizationPointCommandKinds = [
|
|
60
|
+
"lookup_points",
|
|
61
|
+
"add_points",
|
|
62
|
+
"redeem_points",
|
|
63
|
+
"refund_points"
|
|
64
|
+
];
|
|
65
|
+
var organizationPointCommandStatuses = [
|
|
66
|
+
"requested",
|
|
67
|
+
"accepted",
|
|
68
|
+
"completed",
|
|
69
|
+
"failed"
|
|
70
|
+
];
|
|
56
71
|
var organizationPointTypeStatuses = ["active", "archived"];
|
|
57
72
|
var organizationMemberSyncTriggerKinds = [
|
|
58
73
|
"manual",
|
|
@@ -316,6 +331,83 @@ var CompleteOnsiteVoucherCommandSchema = Schema2.Struct({
|
|
|
316
331
|
rawRecord: Schema2.optional(Schema2.Unknown),
|
|
317
332
|
errorMessage: OptionalNullableString
|
|
318
333
|
});
|
|
334
|
+
var OrganizationPointProviderSchema = Schema2.Struct({
|
|
335
|
+
id: Schema2.String,
|
|
336
|
+
organizationId: Schema2.String,
|
|
337
|
+
provider: Schema2.Literal(...organizationPointProviderProviders),
|
|
338
|
+
transport: Schema2.Literal(...organizationPointProviderTransports),
|
|
339
|
+
status: Schema2.Literal(...organizationPointProviderStatuses),
|
|
340
|
+
config: JsonObjectSchema,
|
|
341
|
+
hasSecrets: Schema2.Boolean,
|
|
342
|
+
secretNames: Schema2.Array(Schema2.Struct({ name: Schema2.String })),
|
|
343
|
+
lastError: NullableString,
|
|
344
|
+
createdAt: TimestampSchema,
|
|
345
|
+
updatedAt: TimestampSchema,
|
|
346
|
+
deletedAt: Schema2.Union(TimestampSchema, Schema2.Null)
|
|
347
|
+
});
|
|
348
|
+
var OrganizationPointCommandSchema = Schema2.Struct({
|
|
349
|
+
id: Schema2.String,
|
|
350
|
+
organizationId: Schema2.String,
|
|
351
|
+
organizationPointProviderId: Schema2.String,
|
|
352
|
+
serviceClientId: NullableString,
|
|
353
|
+
kind: Schema2.Literal(...organizationPointCommandKinds),
|
|
354
|
+
status: Schema2.Literal(...organizationPointCommandStatuses),
|
|
355
|
+
payload: JsonObjectSchema,
|
|
356
|
+
result: Schema2.Union(JsonObjectSchema, Schema2.Null),
|
|
357
|
+
errorMessage: NullableString,
|
|
358
|
+
requestedAt: TimestampSchema,
|
|
359
|
+
acceptedAt: Schema2.Union(TimestampSchema, Schema2.Null),
|
|
360
|
+
completedAt: Schema2.Union(TimestampSchema, Schema2.Null),
|
|
361
|
+
createdAt: TimestampSchema,
|
|
362
|
+
updatedAt: TimestampSchema,
|
|
363
|
+
deletedAt: Schema2.Union(TimestampSchema, Schema2.Null)
|
|
364
|
+
});
|
|
365
|
+
var UpsertOrganizationPointProviderSchema = Schema2.Struct({
|
|
366
|
+
provider: Schema2.Literal(...organizationPointProviderProviders),
|
|
367
|
+
transport: Schema2.Literal(...organizationPointProviderTransports),
|
|
368
|
+
status: Schema2.optional(Schema2.Literal(...organizationPointProviderStatuses)),
|
|
369
|
+
config: JsonObjectSchema,
|
|
370
|
+
secrets: Schema2.optional(Schema2.Array(OrganizationVoucherProviderSecretInputSchema))
|
|
371
|
+
});
|
|
372
|
+
var RequestPointLookupSchema = Schema2.Struct({
|
|
373
|
+
memberId: Schema2.optional(Schema2.String),
|
|
374
|
+
externalSystemMemberId: OptionalNullableString,
|
|
375
|
+
memberNumber: OptionalNullableString,
|
|
376
|
+
cardData: OptionalNullableString,
|
|
377
|
+
account: Schema2.optional(Schema2.Union(Schema2.String, Schema2.Number)),
|
|
378
|
+
packetNumber: Schema2.optional(Schema2.Union(Schema2.String, Schema2.Number)),
|
|
379
|
+
metadata: Schema2.optional(JsonObjectSchema)
|
|
380
|
+
});
|
|
381
|
+
var RequestPointDebitSchema = Schema2.Struct({
|
|
382
|
+
memberId: Schema2.optional(Schema2.String),
|
|
383
|
+
externalSystemMemberId: OptionalNullableString,
|
|
384
|
+
memberNumber: OptionalNullableString,
|
|
385
|
+
cardData: OptionalNullableString,
|
|
386
|
+
amount: Schema2.Number,
|
|
387
|
+
account: Schema2.optional(Schema2.Union(Schema2.String, Schema2.Number)),
|
|
388
|
+
packetNumber: Schema2.optional(Schema2.Union(Schema2.String, Schema2.Number)),
|
|
389
|
+
metadata: Schema2.optional(JsonObjectSchema)
|
|
390
|
+
});
|
|
391
|
+
var OnsitePointCommandSchema = Schema2.Struct({
|
|
392
|
+
commandId: Schema2.String,
|
|
393
|
+
organizationId: Schema2.String,
|
|
394
|
+
organizationPointProviderId: Schema2.String,
|
|
395
|
+
provider: Schema2.Literal(...organizationPointProviderProviders),
|
|
396
|
+
transport: Schema2.Literal(...organizationPointProviderTransports),
|
|
397
|
+
requestedAt: TimestampSchema,
|
|
398
|
+
kind: Schema2.Literal(...organizationPointCommandKinds),
|
|
399
|
+
payload: JsonObjectSchema,
|
|
400
|
+
config: JsonObjectSchema,
|
|
401
|
+
secrets: Schema2.Array(OrganizationVoucherProviderSecretInputSchema)
|
|
402
|
+
});
|
|
403
|
+
var CompleteOnsitePointCommandSchema = Schema2.Struct({
|
|
404
|
+
balance: OptionalNullableNumber,
|
|
405
|
+
scaledBalance: OptionalNullableNumber,
|
|
406
|
+
memberName: OptionalNullableString,
|
|
407
|
+
memberNumber: OptionalNullableString,
|
|
408
|
+
rawResponse: Schema2.optional(Schema2.Unknown),
|
|
409
|
+
errorMessage: OptionalNullableString
|
|
410
|
+
});
|
|
319
411
|
var OrganizationPointTypeSchema = Schema2.Struct({
|
|
320
412
|
id: Schema2.String,
|
|
321
413
|
organizationId: Schema2.String,
|
|
@@ -614,11 +706,7 @@ var OrganizationMembersSearchFieldSchema = Schema2.Literal(
|
|
|
614
706
|
"cardId",
|
|
615
707
|
"externalSystemMemberId"
|
|
616
708
|
);
|
|
617
|
-
var OrganizationMembersSortFieldSchema = Schema2.Literal(
|
|
618
|
-
"memberNumber",
|
|
619
|
-
"name",
|
|
620
|
-
"dob"
|
|
621
|
-
);
|
|
709
|
+
var OrganizationMembersSortFieldSchema = Schema2.Literal("memberNumber", "name", "dob");
|
|
622
710
|
var SortDirectionSchema = Schema2.Literal("asc", "desc");
|
|
623
711
|
var OrganizationMembersListUrlParamsSchema = Schema2.Struct({
|
|
624
712
|
page: optionalQueryString("1-based page number. Defaults to 1 when omitted or invalid.", {
|
|
@@ -2763,6 +2851,26 @@ var OnsiteResourceCallRequestSchema = Schema2.Union(
|
|
|
2763
2851
|
operation: Schema2.Literal("voucher.issue"),
|
|
2764
2852
|
waitMs: OnsiteResourceCallWaitMsSchema,
|
|
2765
2853
|
payload: RequestVoucherIssueSchema
|
|
2854
|
+
}),
|
|
2855
|
+
Schema2.Struct({
|
|
2856
|
+
operation: Schema2.Literal("points.lookup"),
|
|
2857
|
+
waitMs: OnsiteResourceCallWaitMsSchema,
|
|
2858
|
+
payload: RequestPointLookupSchema
|
|
2859
|
+
}),
|
|
2860
|
+
Schema2.Struct({
|
|
2861
|
+
operation: Schema2.Literal("points.add"),
|
|
2862
|
+
waitMs: OnsiteResourceCallWaitMsSchema,
|
|
2863
|
+
payload: RequestPointDebitSchema
|
|
2864
|
+
}),
|
|
2865
|
+
Schema2.Struct({
|
|
2866
|
+
operation: Schema2.Literal("points.redeem"),
|
|
2867
|
+
waitMs: OnsiteResourceCallWaitMsSchema,
|
|
2868
|
+
payload: RequestPointDebitSchema
|
|
2869
|
+
}),
|
|
2870
|
+
Schema2.Struct({
|
|
2871
|
+
operation: Schema2.Literal("points.refund"),
|
|
2872
|
+
waitMs: OnsiteResourceCallWaitMsSchema,
|
|
2873
|
+
payload: RequestPointDebitSchema
|
|
2766
2874
|
})
|
|
2767
2875
|
);
|
|
2768
2876
|
var OnsiteResourceMemberCallResponseSchema = Schema2.Struct({
|
|
@@ -2779,9 +2887,17 @@ var OnsiteResourceVoucherCallResponseSchema = Schema2.Struct({
|
|
|
2779
2887
|
timedOut: Schema2.Boolean,
|
|
2780
2888
|
command: OrganizationVoucherCommandSchema
|
|
2781
2889
|
});
|
|
2890
|
+
var OnsiteResourcePointCallResponseSchema = Schema2.Struct({
|
|
2891
|
+
kind: Schema2.Literal("points"),
|
|
2892
|
+
operation: Schema2.Literal("points.lookup", "points.add", "points.redeem", "points.refund"),
|
|
2893
|
+
settled: Schema2.Boolean,
|
|
2894
|
+
timedOut: Schema2.Boolean,
|
|
2895
|
+
command: OrganizationPointCommandSchema
|
|
2896
|
+
});
|
|
2782
2897
|
var OnsiteResourceCallResponseSchema = Schema2.Union(
|
|
2783
2898
|
OnsiteResourceMemberCallResponseSchema,
|
|
2784
|
-
OnsiteResourceVoucherCallResponseSchema
|
|
2899
|
+
OnsiteResourceVoucherCallResponseSchema,
|
|
2900
|
+
OnsiteResourcePointCallResponseSchema
|
|
2785
2901
|
);
|
|
2786
2902
|
var SourceManagedMemberUpdateCommandPayloadSchema = Schema2.Struct({
|
|
2787
2903
|
memberId: Schema2.String,
|
|
@@ -3009,10 +3125,7 @@ var OrganizationProductOptionParams = Schema2.Struct({
|
|
|
3009
3125
|
organizationProductOptionId: HttpApiSchema2.param("organizationProductOptionId", Schema2.String)
|
|
3010
3126
|
});
|
|
3011
3127
|
var OrganizationProductWebhookParams = Schema2.Struct({
|
|
3012
|
-
organizationProductWebhookId: HttpApiSchema2.param(
|
|
3013
|
-
"organizationProductWebhookId",
|
|
3014
|
-
Schema2.String
|
|
3015
|
-
)
|
|
3128
|
+
organizationProductWebhookId: HttpApiSchema2.param("organizationProductWebhookId", Schema2.String)
|
|
3016
3129
|
});
|
|
3017
3130
|
var OrganizationMemberSourceCommandParams = Schema2.Struct({
|
|
3018
3131
|
organizationId: HttpApiSchema2.param("organizationId", Schema2.String),
|
|
@@ -3081,12 +3194,9 @@ var organizationsGroup = HttpApiGroup.make("organizations").add(
|
|
|
3081
3194
|
"/organization-products/:organizationProductOptionId/webhooks"
|
|
3082
3195
|
).setPath(OrganizationProductOptionParams).setUrlParams(
|
|
3083
3196
|
Schema2.Struct({
|
|
3084
|
-
page: optionalQueryString(
|
|
3085
|
-
"1
|
|
3086
|
-
|
|
3087
|
-
example: "1"
|
|
3088
|
-
}
|
|
3089
|
-
),
|
|
3197
|
+
page: optionalQueryString("1-based page number. Defaults to 1 when omitted or invalid.", {
|
|
3198
|
+
example: "1"
|
|
3199
|
+
}),
|
|
3090
3200
|
pageSize: optionalQueryString(
|
|
3091
3201
|
"Number of organization product webhooks per page. Defaults to 25 and is capped at 100.",
|
|
3092
3202
|
{
|
|
@@ -3095,7 +3205,9 @@ var organizationsGroup = HttpApiGroup.make("organizations").add(
|
|
|
3095
3205
|
)
|
|
3096
3206
|
})
|
|
3097
3207
|
).addSuccess(PaginatedOrganizationProductWebhooksSchema).annotateContext(
|
|
3098
|
-
OpenApi.annotations({
|
|
3208
|
+
OpenApi.annotations({
|
|
3209
|
+
summary: "List configured webhooks for an organization product option"
|
|
3210
|
+
})
|
|
3099
3211
|
)
|
|
3100
3212
|
).add(
|
|
3101
3213
|
HttpApiEndpoint.post(
|
|
@@ -3126,16 +3238,12 @@ var organizationsGroup = HttpApiGroup.make("organizations").add(
|
|
|
3126
3238
|
HttpApiEndpoint.put(
|
|
3127
3239
|
"updateOrganizationProductWebhook",
|
|
3128
3240
|
"/organization-product-webhooks/:organizationProductWebhookId"
|
|
3129
|
-
).setPath(OrganizationProductWebhookParams).setPayload(UpdateOrganizationProductWebhookSchema).addSuccess(OrganizationProductWebhookUpsertResponseSchema).annotateContext(
|
|
3130
|
-
OpenApi.annotations({ summary: "Update an organization product webhook" })
|
|
3131
|
-
)
|
|
3241
|
+
).setPath(OrganizationProductWebhookParams).setPayload(UpdateOrganizationProductWebhookSchema).addSuccess(OrganizationProductWebhookUpsertResponseSchema).annotateContext(OpenApi.annotations({ summary: "Update an organization product webhook" }))
|
|
3132
3242
|
).add(
|
|
3133
3243
|
HttpApiEndpoint.del(
|
|
3134
3244
|
"deleteOrganizationProductWebhook",
|
|
3135
3245
|
"/organization-product-webhooks/:organizationProductWebhookId"
|
|
3136
|
-
).setPath(OrganizationProductWebhookParams).addSuccess(OrganizationProductWebhookSchema).annotateContext(
|
|
3137
|
-
OpenApi.annotations({ summary: "Delete an organization product webhook" })
|
|
3138
|
-
)
|
|
3246
|
+
).setPath(OrganizationProductWebhookParams).addSuccess(OrganizationProductWebhookSchema).annotateContext(OpenApi.annotations({ summary: "Delete an organization product webhook" }))
|
|
3139
3247
|
).add(
|
|
3140
3248
|
HttpApiEndpoint.get("listOrganizations", "/organizations").setUrlParams(OrganizationsListUrlParamsSchema).addSuccess(PaginatedOrganizationsSchema).annotateContext(OpenApi.annotations({ summary: "List organizations" }))
|
|
3141
3249
|
).add(
|
|
@@ -3194,7 +3302,10 @@ var membersGroup = HttpApiGroup.make("members").add(
|
|
|
3194
3302
|
})
|
|
3195
3303
|
)
|
|
3196
3304
|
).add(
|
|
3197
|
-
HttpApiEndpoint.post(
|
|
3305
|
+
HttpApiEndpoint.post(
|
|
3306
|
+
"bulkGetOrganizationMembers",
|
|
3307
|
+
"/organizations/:organizationId/members/bulk"
|
|
3308
|
+
).setPath(OrganizationIdParams).setPayload(BulkGetOrganizationMembersSchema).addSuccess(BulkOrganizationMembersResponseUnionSchema).annotateContext(
|
|
3198
3309
|
OpenApi.annotations({
|
|
3199
3310
|
summary: "Fetch up to 50 members by Spoke Hub member ID for an organization",
|
|
3200
3311
|
transform: bulkMemberExamplesTransform
|
|
@@ -3337,7 +3448,10 @@ var memberPointsGroup = HttpApiGroup.make("memberPoints").add(
|
|
|
3337
3448
|
})
|
|
3338
3449
|
)
|
|
3339
3450
|
).add(
|
|
3340
|
-
HttpApiEndpoint.post(
|
|
3451
|
+
HttpApiEndpoint.post(
|
|
3452
|
+
"createOrganizationPointType",
|
|
3453
|
+
"/organizations/:organizationId/point-types"
|
|
3454
|
+
).setPath(OrganizationIdParams).setPayload(CreateOrganizationPointTypeSchema).addSuccess(OrganizationPointTypeSchema, { status: 201 }).annotateContext(
|
|
3341
3455
|
OpenApi.annotations({
|
|
3342
3456
|
summary: "Create a point type for an organization"
|
|
3343
3457
|
})
|
|
@@ -3382,11 +3496,22 @@ var vouchersGroup = HttpApiGroup.make("vouchers").add(
|
|
|
3382
3496
|
"upsertOrganizationVoucherProvider",
|
|
3383
3497
|
"/organizations/:organizationId/voucher-provider"
|
|
3384
3498
|
).setPath(OrganizationIdParams).setPayload(UpsertOrganizationVoucherProviderSchema).addSuccess(OrganizationVoucherProviderSchema).annotateContext(
|
|
3385
|
-
OpenApi.annotations({
|
|
3499
|
+
OpenApi.annotations({
|
|
3500
|
+
summary: "Create or update the voucher provider for an organization"
|
|
3501
|
+
})
|
|
3386
3502
|
)
|
|
3387
3503
|
).add(
|
|
3388
3504
|
HttpApiEndpoint.post("requestVoucherIssue", "/organizations/:organizationId/vouchers/issue").setPath(OrganizationIdParams).setPayload(RequestVoucherIssueSchema).addSuccess(OrganizationVoucherCommandSchema, { status: 202 }).annotateContext(
|
|
3389
|
-
OpenApi.annotations({
|
|
3505
|
+
OpenApi.annotations({
|
|
3506
|
+
summary: "Request a voucher issue through the onsite voucher client"
|
|
3507
|
+
})
|
|
3508
|
+
)
|
|
3509
|
+
).add(
|
|
3510
|
+
HttpApiEndpoint.get(
|
|
3511
|
+
"getOrganizationVoucherCommand",
|
|
3512
|
+
"/organizations/:organizationId/voucher-commands/:commandId"
|
|
3513
|
+
).setPath(OrganizationVoucherCommandParams).addSuccess(OrganizationVoucherCommandSchema).annotateContext(
|
|
3514
|
+
OpenApi.annotations({ summary: "Get a specific voucher command for an organization" })
|
|
3390
3515
|
)
|
|
3391
3516
|
).add(
|
|
3392
3517
|
HttpApiEndpoint.post(
|
|
@@ -3405,14 +3530,74 @@ var vouchersGroup = HttpApiGroup.make("vouchers").add(
|
|
|
3405
3530
|
HttpApiEndpoint.post(
|
|
3406
3531
|
"completeOnsiteVoucherCommand",
|
|
3407
3532
|
"/organizations/:organizationId/onsite-voucher-commands/:commandId/complete"
|
|
3408
|
-
).setPath(OrganizationVoucherCommandParams).setPayload(CompleteOnsiteVoucherCommandSchema).addSuccess(OrganizationVoucherCommandSchema).annotateContext(
|
|
3409
|
-
|
|
3533
|
+
).setPath(OrganizationVoucherCommandParams).setPayload(CompleteOnsiteVoucherCommandSchema).addSuccess(OrganizationVoucherCommandSchema).annotateContext(OpenApi.annotations({ summary: "Complete an onsite voucher command" }))
|
|
3534
|
+
);
|
|
3535
|
+
var pointProvidersGroup = HttpApiGroup.make("pointProviders").add(
|
|
3536
|
+
HttpApiEndpoint.get(
|
|
3537
|
+
"getOrganizationPointProvider",
|
|
3538
|
+
"/organizations/:organizationId/point-provider"
|
|
3539
|
+
).setPath(OrganizationIdParams).addSuccess(Schema2.Union(OrganizationPointProviderSchema, Schema2.Null)).annotateContext(
|
|
3540
|
+
OpenApi.annotations({ summary: "Get the live points provider for an organization" })
|
|
3541
|
+
)
|
|
3542
|
+
).add(
|
|
3543
|
+
HttpApiEndpoint.put(
|
|
3544
|
+
"upsertOrganizationPointProvider",
|
|
3545
|
+
"/organizations/:organizationId/point-provider"
|
|
3546
|
+
).setPath(OrganizationIdParams).setPayload(UpsertOrganizationPointProviderSchema).addSuccess(OrganizationPointProviderSchema).annotateContext(
|
|
3547
|
+
OpenApi.annotations({
|
|
3548
|
+
summary: "Create or update the live points provider for an organization"
|
|
3549
|
+
})
|
|
3550
|
+
)
|
|
3551
|
+
).add(
|
|
3552
|
+
HttpApiEndpoint.post("requestPointLookup", "/organizations/:organizationId/points/lookup").setPath(OrganizationIdParams).setPayload(RequestPointLookupSchema).addSuccess(OrganizationPointCommandSchema, { status: 202 }).annotateContext(
|
|
3553
|
+
OpenApi.annotations({ summary: "Request a live points lookup through the onsite client" })
|
|
3554
|
+
)
|
|
3555
|
+
).add(
|
|
3556
|
+
HttpApiEndpoint.post("requestPointAdd", "/organizations/:organizationId/points/add").setPath(OrganizationIdParams).setPayload(RequestPointDebitSchema).addSuccess(OrganizationPointCommandSchema, { status: 202 }).annotateContext(
|
|
3557
|
+
OpenApi.annotations({
|
|
3558
|
+
summary: "Request a live points add through the onsite client"
|
|
3559
|
+
})
|
|
3560
|
+
)
|
|
3561
|
+
).add(
|
|
3562
|
+
HttpApiEndpoint.post("requestPointRedeem", "/organizations/:organizationId/points/redeem").setPath(OrganizationIdParams).setPayload(RequestPointDebitSchema).addSuccess(OrganizationPointCommandSchema, { status: 202 }).annotateContext(
|
|
3563
|
+
OpenApi.annotations({
|
|
3564
|
+
summary: "Request a live points redemption through the onsite client"
|
|
3565
|
+
})
|
|
3566
|
+
)
|
|
3567
|
+
).add(
|
|
3568
|
+
HttpApiEndpoint.post("requestPointRefund", "/organizations/:organizationId/points/refund").setPath(OrganizationIdParams).setPayload(RequestPointDebitSchema).addSuccess(OrganizationPointCommandSchema, { status: 202 }).annotateContext(
|
|
3569
|
+
OpenApi.annotations({ summary: "Request a live points refund through the onsite client" })
|
|
3570
|
+
)
|
|
3571
|
+
).add(
|
|
3572
|
+
HttpApiEndpoint.get(
|
|
3573
|
+
"getOrganizationPointCommand",
|
|
3574
|
+
"/organizations/:organizationId/point-commands/:commandId"
|
|
3575
|
+
).setPath(OrganizationVoucherCommandParams).addSuccess(OrganizationPointCommandSchema).annotateContext(
|
|
3576
|
+
OpenApi.annotations({ summary: "Get a specific point command for an organization" })
|
|
3577
|
+
)
|
|
3578
|
+
).add(
|
|
3579
|
+
HttpApiEndpoint.post(
|
|
3580
|
+
"pollOnsitePointCommand",
|
|
3581
|
+
"/organizations/:organizationId/onsite-point-commands/poll"
|
|
3582
|
+
).setPath(OrganizationIdParams).addSuccess(Schema2.Union(OnsitePointCommandSchema, Schema2.Null)).annotateContext(
|
|
3583
|
+
OpenApi.annotations({ summary: "Poll for the next pending onsite point command" })
|
|
3584
|
+
)
|
|
3585
|
+
).add(
|
|
3586
|
+
HttpApiEndpoint.post("pollCurrentOnsitePointCommand", "/onsite-point-commands/poll").addSuccess(Schema2.Union(OnsitePointCommandSchema, Schema2.Null)).annotateContext(
|
|
3587
|
+
OpenApi.annotations({
|
|
3588
|
+
summary: "Poll for the next pending onsite point command for the signed credential"
|
|
3589
|
+
})
|
|
3410
3590
|
)
|
|
3591
|
+
).add(
|
|
3592
|
+
HttpApiEndpoint.post(
|
|
3593
|
+
"completeOnsitePointCommand",
|
|
3594
|
+
"/organizations/:organizationId/onsite-point-commands/:commandId/complete"
|
|
3595
|
+
).setPath(OrganizationVoucherCommandParams).setPayload(CompleteOnsitePointCommandSchema).addSuccess(OrganizationPointCommandSchema).annotateContext(OpenApi.annotations({ summary: "Complete an onsite point command" }))
|
|
3411
3596
|
);
|
|
3412
3597
|
var onsiteCallsGroup = HttpApiGroup.make("onsiteCalls").add(
|
|
3413
3598
|
HttpApiEndpoint.post("callOnsiteResource", "/organizations/:organizationId/onsite-calls").setPath(OrganizationIdParams).setPayload(OnsiteResourceCallRequestSchema).addSuccess(OnsiteResourceCallResponseSchema).annotateContext(
|
|
3414
3599
|
OpenApi.annotations({
|
|
3415
|
-
summary: "Call a live onsite member or
|
|
3600
|
+
summary: "Call a live onsite member, voucher, or points resource and wait briefly for completion"
|
|
3416
3601
|
})
|
|
3417
3602
|
)
|
|
3418
3603
|
);
|
|
@@ -3700,7 +3885,7 @@ var serviceClientsGroup = HttpApiGroup.make("serviceClients").add(
|
|
|
3700
3885
|
})
|
|
3701
3886
|
)
|
|
3702
3887
|
);
|
|
3703
|
-
var HubApi = HttpApi.make("hub").add(authGroup).add(organizationsGroup).add(membersGroup).add(memberPointsGroup).add(vouchersGroup).add(onsiteCallsGroup).add(memberSourcesGroup).add(onsiteAgentsGroup).add(guestsGroup).add(serviceClientsGroup).prefix("/v1").addError(UnauthorizedErrorSchema).addError(ForbiddenErrorSchema).addError(NotFoundErrorSchema).addError(ConflictErrorSchema).addError(BadRequestErrorSchema).annotateContext(
|
|
3888
|
+
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(
|
|
3704
3889
|
OpenApi.annotations({
|
|
3705
3890
|
title: "Spoke Hub API",
|
|
3706
3891
|
version: "1.0.0",
|
|
@@ -3715,6 +3900,10 @@ var SpokeHubClientError = class extends Error {
|
|
|
3715
3900
|
kind;
|
|
3716
3901
|
code;
|
|
3717
3902
|
body;
|
|
3903
|
+
status;
|
|
3904
|
+
method;
|
|
3905
|
+
url;
|
|
3906
|
+
reason;
|
|
3718
3907
|
cause;
|
|
3719
3908
|
constructor(input) {
|
|
3720
3909
|
super(input.message);
|
|
@@ -3722,16 +3911,47 @@ var SpokeHubClientError = class extends Error {
|
|
|
3722
3911
|
this.kind = input.kind;
|
|
3723
3912
|
this.code = input.code;
|
|
3724
3913
|
this.body = input.body;
|
|
3914
|
+
this.status = input.status;
|
|
3915
|
+
this.method = input.method;
|
|
3916
|
+
this.url = input.url;
|
|
3917
|
+
this.reason = input.reason;
|
|
3725
3918
|
this.cause = input.cause;
|
|
3919
|
+
Object.defineProperty(this, "cause", {
|
|
3920
|
+
value: input.cause,
|
|
3921
|
+
enumerable: false,
|
|
3922
|
+
configurable: true
|
|
3923
|
+
});
|
|
3924
|
+
}
|
|
3925
|
+
toJSON() {
|
|
3926
|
+
return Object.fromEntries(
|
|
3927
|
+
Object.entries({
|
|
3928
|
+
name: this.name,
|
|
3929
|
+
kind: this.kind,
|
|
3930
|
+
code: this.code,
|
|
3931
|
+
message: this.message,
|
|
3932
|
+
status: this.status,
|
|
3933
|
+
method: this.method,
|
|
3934
|
+
url: this.url,
|
|
3935
|
+
reason: this.reason,
|
|
3936
|
+
body: this.body
|
|
3937
|
+
}).filter(([, value]) => value !== void 0)
|
|
3938
|
+
);
|
|
3939
|
+
}
|
|
3940
|
+
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
|
|
3941
|
+
return this.toJSON();
|
|
3726
3942
|
}
|
|
3727
3943
|
};
|
|
3728
3944
|
var SpokeHubApiError = class extends SpokeHubClientError {
|
|
3729
|
-
constructor(body, cause) {
|
|
3945
|
+
constructor(body, cause, context = {}) {
|
|
3730
3946
|
super({
|
|
3731
3947
|
kind: "api",
|
|
3732
3948
|
message: body.message ?? body.code ?? "Spoke Hub API request failed",
|
|
3733
3949
|
code: body.code,
|
|
3734
3950
|
body,
|
|
3951
|
+
status: context.status,
|
|
3952
|
+
method: context.method,
|
|
3953
|
+
url: context.url,
|
|
3954
|
+
reason: context.reason,
|
|
3735
3955
|
cause
|
|
3736
3956
|
});
|
|
3737
3957
|
this.name = "SpokeHubApiError";
|
|
@@ -3829,6 +4049,81 @@ function configureSignedHttpClient(client, options) {
|
|
|
3829
4049
|
})
|
|
3830
4050
|
);
|
|
3831
4051
|
}
|
|
4052
|
+
var fiberFailureCauseSymbol = /* @__PURE__ */ Symbol.for("effect/Runtime/FiberFailure/Cause");
|
|
4053
|
+
function isRecord(value) {
|
|
4054
|
+
return !!value && typeof value === "object";
|
|
4055
|
+
}
|
|
4056
|
+
function stringFromUnknown(value) {
|
|
4057
|
+
if (typeof value === "string" && value.length > 0) {
|
|
4058
|
+
return value;
|
|
4059
|
+
}
|
|
4060
|
+
if (value instanceof URL) {
|
|
4061
|
+
return value.toString();
|
|
4062
|
+
}
|
|
4063
|
+
return void 0;
|
|
4064
|
+
}
|
|
4065
|
+
function numberFromUnknown(value) {
|
|
4066
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
4067
|
+
}
|
|
4068
|
+
function failureErrorFromUnknown(value) {
|
|
4069
|
+
if (!isRecord(value)) {
|
|
4070
|
+
return void 0;
|
|
4071
|
+
}
|
|
4072
|
+
const fiberFailureCause = value[fiberFailureCauseSymbol];
|
|
4073
|
+
if (isRecord(fiberFailureCause) && "error" in fiberFailureCause) {
|
|
4074
|
+
return fiberFailureCause.error;
|
|
4075
|
+
}
|
|
4076
|
+
return void 0;
|
|
4077
|
+
}
|
|
4078
|
+
function errorCandidatesFromUnknown(value) {
|
|
4079
|
+
const candidates = [value];
|
|
4080
|
+
const failureError = failureErrorFromUnknown(value);
|
|
4081
|
+
if (failureError) {
|
|
4082
|
+
candidates.push(failureError);
|
|
4083
|
+
}
|
|
4084
|
+
for (const candidate of [...candidates]) {
|
|
4085
|
+
if (candidate instanceof Error && candidate.cause) {
|
|
4086
|
+
candidates.push(candidate.cause);
|
|
4087
|
+
} else if (isRecord(candidate) && candidate.cause) {
|
|
4088
|
+
candidates.push(candidate.cause);
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
return candidates;
|
|
4092
|
+
}
|
|
4093
|
+
function httpContextFromMessage(message) {
|
|
4094
|
+
const match = message.match(/\((\d{3})\s+([A-Z]+)\s+([^)]+)\)/);
|
|
4095
|
+
if (!match) {
|
|
4096
|
+
return {};
|
|
4097
|
+
}
|
|
4098
|
+
return {
|
|
4099
|
+
status: Number(match[1]),
|
|
4100
|
+
method: match[2],
|
|
4101
|
+
url: match[3]
|
|
4102
|
+
};
|
|
4103
|
+
}
|
|
4104
|
+
function httpContextFromUnknown(value) {
|
|
4105
|
+
const context = {};
|
|
4106
|
+
for (const candidate of errorCandidatesFromUnknown(value)) {
|
|
4107
|
+
if (candidate instanceof Error) {
|
|
4108
|
+
Object.assign(context, httpContextFromMessage(candidate.message));
|
|
4109
|
+
}
|
|
4110
|
+
if (!isRecord(candidate)) {
|
|
4111
|
+
continue;
|
|
4112
|
+
}
|
|
4113
|
+
const request = candidate.request;
|
|
4114
|
+
const response = candidate.response;
|
|
4115
|
+
const requestRecord = isRecord(request) ? request : void 0;
|
|
4116
|
+
const responseRecord = isRecord(response) ? response : void 0;
|
|
4117
|
+
context.status ??= numberFromUnknown(responseRecord?.status);
|
|
4118
|
+
context.method ??= stringFromUnknown(requestRecord?.method);
|
|
4119
|
+
context.url ??= stringFromUnknown(requestRecord?.url) ?? stringFromUnknown(responseRecord?.url);
|
|
4120
|
+
context.reason ??= stringFromUnknown(candidate.reason);
|
|
4121
|
+
if (context.status !== void 0 && context.method !== void 0 && context.url !== void 0 && context.reason !== void 0) {
|
|
4122
|
+
break;
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
return context;
|
|
4126
|
+
}
|
|
3832
4127
|
function hasApiErrorBody(value) {
|
|
3833
4128
|
if (value instanceof Error) {
|
|
3834
4129
|
return false;
|
|
@@ -3837,40 +4132,29 @@ function hasApiErrorBody(value) {
|
|
|
3837
4132
|
return !!value && typeof value === "object" && (typeof body.message === "string" || typeof body.code === "string");
|
|
3838
4133
|
}
|
|
3839
4134
|
function apiErrorBodyFromUnknown(value) {
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
if (value instanceof Error) {
|
|
3844
|
-
const cause = value.cause;
|
|
3845
|
-
if (hasApiErrorBody(cause)) {
|
|
3846
|
-
return cause;
|
|
3847
|
-
}
|
|
3848
|
-
}
|
|
3849
|
-
if (value && typeof value === "object") {
|
|
3850
|
-
const cause = value.cause;
|
|
3851
|
-
if (hasApiErrorBody(cause)) {
|
|
3852
|
-
return cause;
|
|
3853
|
-
}
|
|
3854
|
-
const fiberFailureCause = value[/* @__PURE__ */ Symbol.for("effect/Runtime/FiberFailure/Cause")];
|
|
3855
|
-
if (fiberFailureCause && typeof fiberFailureCause === "object") {
|
|
3856
|
-
const error = fiberFailureCause.error;
|
|
3857
|
-
if (hasApiErrorBody(error)) {
|
|
3858
|
-
return error;
|
|
3859
|
-
}
|
|
4135
|
+
for (const candidate of errorCandidatesFromUnknown(value)) {
|
|
4136
|
+
if (hasApiErrorBody(candidate)) {
|
|
4137
|
+
return candidate;
|
|
3860
4138
|
}
|
|
3861
4139
|
}
|
|
3862
4140
|
return null;
|
|
3863
4141
|
}
|
|
3864
4142
|
function errorMessageFromUnknown(value) {
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
4143
|
+
for (const candidate of errorCandidatesFromUnknown(value)) {
|
|
4144
|
+
if (candidate instanceof Error && candidate.message.length > 0) {
|
|
4145
|
+
return candidate.message;
|
|
4146
|
+
}
|
|
4147
|
+
if (typeof candidate === "string" && candidate.length > 0) {
|
|
4148
|
+
return candidate;
|
|
4149
|
+
}
|
|
3870
4150
|
}
|
|
3871
4151
|
return "Spoke Hub client request failed";
|
|
3872
4152
|
}
|
|
3873
4153
|
function classifyClientError(value) {
|
|
4154
|
+
const context = httpContextFromUnknown(value);
|
|
4155
|
+
if (context.status !== void 0) {
|
|
4156
|
+
return "api";
|
|
4157
|
+
}
|
|
3874
4158
|
const message = errorMessageFromUnknown(value).toLowerCase();
|
|
3875
4159
|
if (value instanceof TypeError || message.includes("fetch failed") || message.includes("network") || message.includes("econnrefused") || message.includes("enotfound") || message.includes("etimedout")) {
|
|
3876
4160
|
return "network";
|
|
@@ -3882,12 +4166,19 @@ function classifyClientError(value) {
|
|
|
3882
4166
|
}
|
|
3883
4167
|
function clientErrorFromUnknown(value) {
|
|
3884
4168
|
const body = apiErrorBodyFromUnknown(value);
|
|
4169
|
+
const context = httpContextFromUnknown(value);
|
|
3885
4170
|
if (body) {
|
|
3886
|
-
return new SpokeHubApiError(body, value);
|
|
4171
|
+
return new SpokeHubApiError(body, value, context);
|
|
3887
4172
|
}
|
|
4173
|
+
const statusCode = context.status ? `http_${context.status}` : void 0;
|
|
3888
4174
|
return new SpokeHubClientError({
|
|
3889
4175
|
kind: classifyClientError(value),
|
|
4176
|
+
code: statusCode,
|
|
3890
4177
|
message: errorMessageFromUnknown(value),
|
|
4178
|
+
status: context.status,
|
|
4179
|
+
method: context.method,
|
|
4180
|
+
url: context.url,
|
|
4181
|
+
reason: context.reason,
|
|
3891
4182
|
cause: value
|
|
3892
4183
|
});
|
|
3893
4184
|
}
|
|
@@ -4018,6 +4309,32 @@ function makeOnsiteResourceClient(client) {
|
|
|
4018
4309
|
operation: "voucher.issue",
|
|
4019
4310
|
payload: input.payload
|
|
4020
4311
|
})
|
|
4312
|
+
},
|
|
4313
|
+
points: {
|
|
4314
|
+
lookup: (input) => call({
|
|
4315
|
+
organizationId: input.organizationId,
|
|
4316
|
+
waitMs: input.waitMs,
|
|
4317
|
+
operation: "points.lookup",
|
|
4318
|
+
payload: input.payload
|
|
4319
|
+
}),
|
|
4320
|
+
add: (input) => call({
|
|
4321
|
+
organizationId: input.organizationId,
|
|
4322
|
+
waitMs: input.waitMs,
|
|
4323
|
+
operation: "points.add",
|
|
4324
|
+
payload: input.payload
|
|
4325
|
+
}),
|
|
4326
|
+
redeem: (input) => call({
|
|
4327
|
+
organizationId: input.organizationId,
|
|
4328
|
+
waitMs: input.waitMs,
|
|
4329
|
+
operation: "points.redeem",
|
|
4330
|
+
payload: input.payload
|
|
4331
|
+
}),
|
|
4332
|
+
refund: (input) => call({
|
|
4333
|
+
organizationId: input.organizationId,
|
|
4334
|
+
waitMs: input.waitMs,
|
|
4335
|
+
operation: "points.refund",
|
|
4336
|
+
payload: input.payload
|
|
4337
|
+
})
|
|
4021
4338
|
}
|
|
4022
4339
|
};
|
|
4023
4340
|
}
|
|
@@ -4385,6 +4702,43 @@ function makeSpokeClient(hubClient) {
|
|
|
4385
4702
|
)
|
|
4386
4703
|
}
|
|
4387
4704
|
},
|
|
4705
|
+
posPoints: {
|
|
4706
|
+
getProvider: (input) => unwrap(
|
|
4707
|
+
hubClient.pointProviders.getOrganizationPointProvider({
|
|
4708
|
+
path: { organizationId: input.organizationId }
|
|
4709
|
+
})
|
|
4710
|
+
),
|
|
4711
|
+
upsertProvider: (input) => unwrap(
|
|
4712
|
+
hubClient.pointProviders.upsertOrganizationPointProvider({
|
|
4713
|
+
path: { organizationId: input.organizationId },
|
|
4714
|
+
payload: input.payload
|
|
4715
|
+
})
|
|
4716
|
+
),
|
|
4717
|
+
requestLookup: (input) => unwrap(
|
|
4718
|
+
hubClient.pointProviders.requestPointLookup({
|
|
4719
|
+
path: { organizationId: input.organizationId },
|
|
4720
|
+
payload: input.payload
|
|
4721
|
+
})
|
|
4722
|
+
),
|
|
4723
|
+
requestAdd: (input) => unwrap(
|
|
4724
|
+
hubClient.pointProviders.requestPointAdd({
|
|
4725
|
+
path: { organizationId: input.organizationId },
|
|
4726
|
+
payload: input.payload
|
|
4727
|
+
})
|
|
4728
|
+
),
|
|
4729
|
+
requestRedeem: (input) => unwrap(
|
|
4730
|
+
hubClient.pointProviders.requestPointRedeem({
|
|
4731
|
+
path: { organizationId: input.organizationId },
|
|
4732
|
+
payload: input.payload
|
|
4733
|
+
})
|
|
4734
|
+
),
|
|
4735
|
+
requestRefund: (input) => unwrap(
|
|
4736
|
+
hubClient.pointProviders.requestPointRefund({
|
|
4737
|
+
path: { organizationId: input.organizationId },
|
|
4738
|
+
payload: input.payload
|
|
4739
|
+
})
|
|
4740
|
+
)
|
|
4741
|
+
},
|
|
4388
4742
|
vouchers: {
|
|
4389
4743
|
getProvider: (input) => unwrap(
|
|
4390
4744
|
hubClient.vouchers.getOrganizationVoucherProvider({
|
|
@@ -4468,6 +4822,7 @@ export {
|
|
|
4468
4822
|
BulkOrganizationMembersMedResponseSchema,
|
|
4469
4823
|
BulkOrganizationMembersResponseSchema,
|
|
4470
4824
|
BulkOrganizationMembersResponseUnionSchema,
|
|
4825
|
+
CompleteOnsitePointCommandSchema,
|
|
4471
4826
|
CompleteOnsiteVoucherCommandSchema,
|
|
4472
4827
|
ConflictErrorSchema,
|
|
4473
4828
|
CreateGuestSchema,
|
|
@@ -4519,9 +4874,11 @@ export {
|
|
|
4519
4874
|
OnsiteAgentMemberLookupCommandSchema,
|
|
4520
4875
|
OnsiteAgentMemberRenewalCommandSchema,
|
|
4521
4876
|
OnsiteAgentMemberUpdateCommandSchema,
|
|
4877
|
+
OnsitePointCommandSchema,
|
|
4522
4878
|
OnsiteResourceCallRequestSchema,
|
|
4523
4879
|
OnsiteResourceCallResponseSchema,
|
|
4524
4880
|
OnsiteResourceMemberCallResponseSchema,
|
|
4881
|
+
OnsiteResourcePointCallResponseSchema,
|
|
4525
4882
|
OnsiteResourceVoucherCallResponseSchema,
|
|
4526
4883
|
OnsiteVoucherCommandSchema,
|
|
4527
4884
|
OrganizationMemberGenderSchema,
|
|
@@ -4543,6 +4900,8 @@ export {
|
|
|
4543
4900
|
OrganizationMembersSortFieldSchema,
|
|
4544
4901
|
OrganizationMembersStatusFilterSchema,
|
|
4545
4902
|
OrganizationPeopleContactLookupResponseSchema,
|
|
4903
|
+
OrganizationPointCommandSchema,
|
|
4904
|
+
OrganizationPointProviderSchema,
|
|
4546
4905
|
OrganizationPointTypeSchema,
|
|
4547
4906
|
OrganizationPointTypesResponseSchema,
|
|
4548
4907
|
OrganizationProductOptionSchema,
|
|
@@ -4569,6 +4928,8 @@ export {
|
|
|
4569
4928
|
PaginatedOrganizationsSchema,
|
|
4570
4929
|
PaginatedServiceClientsSchema,
|
|
4571
4930
|
PresignedPostSchema,
|
|
4931
|
+
RequestPointDebitSchema,
|
|
4932
|
+
RequestPointLookupSchema,
|
|
4572
4933
|
RequestSourceManagedMemberCreateSchema,
|
|
4573
4934
|
RequestSourceManagedMemberRenewalSchema,
|
|
4574
4935
|
RequestSourceManagedMemberUpdateSchema,
|
|
@@ -4595,6 +4956,7 @@ export {
|
|
|
4595
4956
|
UpsertOrganizationMemberSourceCsvMappingSchema,
|
|
4596
4957
|
UpsertOrganizationMemberSourceSchema,
|
|
4597
4958
|
UpsertOrganizationMemberSourceWebhookSchema,
|
|
4959
|
+
UpsertOrganizationPointProviderSchema,
|
|
4598
4960
|
UpsertOrganizationProductWebhookSchema,
|
|
4599
4961
|
UpsertOrganizationVoucherProviderSchema,
|
|
4600
4962
|
adminRoles,
|
|
@@ -4632,6 +4994,11 @@ export {
|
|
|
4632
4994
|
organizationMemberSyncRunStatuses,
|
|
4633
4995
|
organizationMemberSyncTransports,
|
|
4634
4996
|
organizationMemberSyncTriggerKinds,
|
|
4997
|
+
organizationPointCommandKinds,
|
|
4998
|
+
organizationPointCommandStatuses,
|
|
4999
|
+
organizationPointProviderProviders,
|
|
5000
|
+
organizationPointProviderStatuses,
|
|
5001
|
+
organizationPointProviderTransports,
|
|
4635
5002
|
organizationPointTypeStatuses,
|
|
4636
5003
|
organizationProductWebhookDeliveryStatuses,
|
|
4637
5004
|
organizationProductWebhookStatuses,
|