@spoketech/hub-client 0.1.10 → 0.1.12
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.d.ts +1863 -180
- package/dist/index.js +73 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ var organizationProductWebhookDeliveryStatuses = ["success", "failure"];
|
|
|
46
46
|
var organizationVoucherProviderProviders = ["senpos"];
|
|
47
47
|
var organizationVoucherProviderTransports = ["onsite_client"];
|
|
48
48
|
var organizationVoucherProviderStatuses = ["active", "disabled"];
|
|
49
|
-
var organizationVoucherCommandKinds = ["issue_voucher"];
|
|
49
|
+
var organizationVoucherCommandKinds = ["issue_voucher", "lookup_voucher"];
|
|
50
50
|
var organizationVoucherCommandStatuses = [
|
|
51
51
|
"requested",
|
|
52
52
|
"accepted",
|
|
@@ -282,6 +282,20 @@ var OrganizationVoucherProviderSchema = Schema2.Struct({
|
|
|
282
282
|
updatedAt: TimestampSchema,
|
|
283
283
|
deletedAt: Schema2.Union(TimestampSchema, Schema2.Null)
|
|
284
284
|
});
|
|
285
|
+
var OrganizationVoucherIssueCommandResultSchema = Schema2.Struct({
|
|
286
|
+
externalMemberId: NullableString,
|
|
287
|
+
memberCode: NullableString,
|
|
288
|
+
externalRewardId: NullableString,
|
|
289
|
+
externalGuid: NullableString,
|
|
290
|
+
rawRecord: Schema2.optional(Schema2.Unknown)
|
|
291
|
+
});
|
|
292
|
+
var OrganizationVoucherLookupCommandResultSchema = Schema2.Struct({
|
|
293
|
+
vouchers: Schema2.Array(JsonObjectSchema)
|
|
294
|
+
});
|
|
295
|
+
var OrganizationVoucherCommandResultSchema = Schema2.Union(
|
|
296
|
+
OrganizationVoucherIssueCommandResultSchema,
|
|
297
|
+
OrganizationVoucherLookupCommandResultSchema
|
|
298
|
+
);
|
|
285
299
|
var OrganizationVoucherCommandSchema = Schema2.Struct({
|
|
286
300
|
id: Schema2.String,
|
|
287
301
|
organizationId: Schema2.String,
|
|
@@ -290,7 +304,7 @@ var OrganizationVoucherCommandSchema = Schema2.Struct({
|
|
|
290
304
|
kind: Schema2.Literal(...organizationVoucherCommandKinds),
|
|
291
305
|
status: Schema2.Literal(...organizationVoucherCommandStatuses),
|
|
292
306
|
payload: JsonObjectSchema,
|
|
293
|
-
result: Schema2.Union(
|
|
307
|
+
result: Schema2.Union(OrganizationVoucherCommandResultSchema, Schema2.Null),
|
|
294
308
|
errorMessage: NullableString,
|
|
295
309
|
requestedAt: TimestampSchema,
|
|
296
310
|
acceptedAt: Schema2.Union(TimestampSchema, Schema2.Null),
|
|
@@ -314,10 +328,17 @@ var RequestVoucherIssueSchema = Schema2.Struct({
|
|
|
314
328
|
quantity: Schema2.optional(Schema2.Number),
|
|
315
329
|
metadata: Schema2.optional(JsonObjectSchema)
|
|
316
330
|
});
|
|
331
|
+
var RequestVoucherLookupSchema = Schema2.Struct({
|
|
332
|
+
memberId: Schema2.optional(Schema2.String),
|
|
333
|
+
externalSystemMemberId: OptionalNullableString,
|
|
334
|
+
memberNumber: OptionalNullableString,
|
|
335
|
+
metadata: Schema2.optional(JsonObjectSchema)
|
|
336
|
+
});
|
|
317
337
|
var OnsiteVoucherCommandSchema = Schema2.Struct({
|
|
318
338
|
commandId: Schema2.String,
|
|
319
339
|
organizationId: Schema2.String,
|
|
320
340
|
organizationVoucherProviderId: Schema2.String,
|
|
341
|
+
kind: Schema2.Literal(...organizationVoucherCommandKinds),
|
|
321
342
|
provider: Schema2.Literal(...organizationVoucherProviderProviders),
|
|
322
343
|
transport: Schema2.Literal(...organizationVoucherProviderTransports),
|
|
323
344
|
requestedAt: TimestampSchema,
|
|
@@ -326,8 +347,11 @@ var OnsiteVoucherCommandSchema = Schema2.Struct({
|
|
|
326
347
|
secrets: Schema2.Array(OrganizationVoucherProviderSecretInputSchema)
|
|
327
348
|
});
|
|
328
349
|
var CompleteOnsiteVoucherCommandSchema = Schema2.Struct({
|
|
350
|
+
externalMemberId: OptionalNullableString,
|
|
351
|
+
memberCode: OptionalNullableString,
|
|
329
352
|
externalRewardId: OptionalNullableString,
|
|
330
353
|
externalGuid: OptionalNullableString,
|
|
354
|
+
vouchers: Schema2.optional(Schema2.Array(JsonObjectSchema)),
|
|
331
355
|
rawRecord: Schema2.optional(Schema2.Unknown),
|
|
332
356
|
errorMessage: OptionalNullableString
|
|
333
357
|
});
|
|
@@ -345,6 +369,18 @@ var OrganizationPointProviderSchema = Schema2.Struct({
|
|
|
345
369
|
updatedAt: TimestampSchema,
|
|
346
370
|
deletedAt: Schema2.Union(TimestampSchema, Schema2.Null)
|
|
347
371
|
});
|
|
372
|
+
var OrganizationPointCommandResultSchema = Schema2.Struct({
|
|
373
|
+
balance: OptionalNullableNumber,
|
|
374
|
+
scaledBalance: OptionalNullableNumber,
|
|
375
|
+
memberName: OptionalNullableString,
|
|
376
|
+
memberNumber: OptionalNullableString,
|
|
377
|
+
rawResponse: Schema2.optional(Schema2.Unknown),
|
|
378
|
+
errorCode: OptionalNullableString,
|
|
379
|
+
errorType: OptionalNullableString,
|
|
380
|
+
errorMessage: OptionalNullableString,
|
|
381
|
+
gatewayMessage: OptionalNullableString,
|
|
382
|
+
gatewayPacketNumber: OptionalNullableString
|
|
383
|
+
});
|
|
348
384
|
var OrganizationPointCommandSchema = Schema2.Struct({
|
|
349
385
|
id: Schema2.String,
|
|
350
386
|
organizationId: Schema2.String,
|
|
@@ -353,7 +389,7 @@ var OrganizationPointCommandSchema = Schema2.Struct({
|
|
|
353
389
|
kind: Schema2.Literal(...organizationPointCommandKinds),
|
|
354
390
|
status: Schema2.Literal(...organizationPointCommandStatuses),
|
|
355
391
|
payload: JsonObjectSchema,
|
|
356
|
-
result: Schema2.Union(
|
|
392
|
+
result: Schema2.Union(OrganizationPointCommandResultSchema, Schema2.Null),
|
|
357
393
|
errorMessage: NullableString,
|
|
358
394
|
requestedAt: TimestampSchema,
|
|
359
395
|
acceptedAt: Schema2.Union(TimestampSchema, Schema2.Null),
|
|
@@ -406,7 +442,11 @@ var CompleteOnsitePointCommandSchema = Schema2.Struct({
|
|
|
406
442
|
memberName: OptionalNullableString,
|
|
407
443
|
memberNumber: OptionalNullableString,
|
|
408
444
|
rawResponse: Schema2.optional(Schema2.Unknown),
|
|
409
|
-
|
|
445
|
+
errorCode: OptionalNullableString,
|
|
446
|
+
errorType: OptionalNullableString,
|
|
447
|
+
errorMessage: OptionalNullableString,
|
|
448
|
+
gatewayMessage: OptionalNullableString,
|
|
449
|
+
gatewayPacketNumber: OptionalNullableString
|
|
410
450
|
});
|
|
411
451
|
var OrganizationPointTypeSchema = Schema2.Struct({
|
|
412
452
|
id: Schema2.String,
|
|
@@ -2852,6 +2892,11 @@ var OnsiteResourceCallRequestSchema = Schema2.Union(
|
|
|
2852
2892
|
waitMs: OnsiteResourceCallWaitMsSchema,
|
|
2853
2893
|
payload: RequestVoucherIssueSchema
|
|
2854
2894
|
}),
|
|
2895
|
+
Schema2.Struct({
|
|
2896
|
+
operation: Schema2.Literal("voucher.lookup"),
|
|
2897
|
+
waitMs: OnsiteResourceCallWaitMsSchema,
|
|
2898
|
+
payload: RequestVoucherLookupSchema
|
|
2899
|
+
}),
|
|
2855
2900
|
Schema2.Struct({
|
|
2856
2901
|
operation: Schema2.Literal("points.lookup"),
|
|
2857
2902
|
waitMs: OnsiteResourceCallWaitMsSchema,
|
|
@@ -2882,7 +2927,7 @@ var OnsiteResourceMemberCallResponseSchema = Schema2.Struct({
|
|
|
2882
2927
|
});
|
|
2883
2928
|
var OnsiteResourceVoucherCallResponseSchema = Schema2.Struct({
|
|
2884
2929
|
kind: Schema2.Literal("voucher"),
|
|
2885
|
-
operation: Schema2.Literal("voucher.issue"),
|
|
2930
|
+
operation: Schema2.Literal("voucher.issue", "voucher.lookup"),
|
|
2886
2931
|
settled: Schema2.Boolean,
|
|
2887
2932
|
timedOut: Schema2.Boolean,
|
|
2888
2933
|
command: OrganizationVoucherCommandSchema
|
|
@@ -3506,6 +3551,12 @@ var vouchersGroup = HttpApiGroup.make("vouchers").add(
|
|
|
3506
3551
|
summary: "Request a voucher issue through the onsite voucher client"
|
|
3507
3552
|
})
|
|
3508
3553
|
)
|
|
3554
|
+
).add(
|
|
3555
|
+
HttpApiEndpoint.post("requestVoucherLookup", "/organizations/:organizationId/vouchers/lookup").setPath(OrganizationIdParams).setPayload(RequestVoucherLookupSchema).addSuccess(OrganizationVoucherCommandSchema, { status: 202 }).annotateContext(
|
|
3556
|
+
OpenApi.annotations({
|
|
3557
|
+
summary: "Request a voucher lookup through the onsite voucher client"
|
|
3558
|
+
})
|
|
3559
|
+
)
|
|
3509
3560
|
).add(
|
|
3510
3561
|
HttpApiEndpoint.get(
|
|
3511
3562
|
"getOrganizationVoucherCommand",
|
|
@@ -4308,6 +4359,12 @@ function makeOnsiteResourceClient(client) {
|
|
|
4308
4359
|
waitMs: input.waitMs,
|
|
4309
4360
|
operation: "voucher.issue",
|
|
4310
4361
|
payload: input.payload
|
|
4362
|
+
}),
|
|
4363
|
+
lookup: (input) => call({
|
|
4364
|
+
organizationId: input.organizationId,
|
|
4365
|
+
waitMs: input.waitMs,
|
|
4366
|
+
operation: "voucher.lookup",
|
|
4367
|
+
payload: input.payload
|
|
4311
4368
|
})
|
|
4312
4369
|
},
|
|
4313
4370
|
points: {
|
|
@@ -4756,6 +4813,12 @@ function makeSpokeClient(hubClient) {
|
|
|
4756
4813
|
path: { organizationId: input.organizationId },
|
|
4757
4814
|
payload: input.payload
|
|
4758
4815
|
})
|
|
4816
|
+
),
|
|
4817
|
+
requestLookup: (input) => unwrap(
|
|
4818
|
+
hubClient.vouchers.requestVoucherLookup({
|
|
4819
|
+
path: { organizationId: input.organizationId },
|
|
4820
|
+
payload: input.payload
|
|
4821
|
+
})
|
|
4759
4822
|
)
|
|
4760
4823
|
},
|
|
4761
4824
|
guests: {
|
|
@@ -4900,6 +4963,7 @@ export {
|
|
|
4900
4963
|
OrganizationMembersSortFieldSchema,
|
|
4901
4964
|
OrganizationMembersStatusFilterSchema,
|
|
4902
4965
|
OrganizationPeopleContactLookupResponseSchema,
|
|
4966
|
+
OrganizationPointCommandResultSchema,
|
|
4903
4967
|
OrganizationPointCommandSchema,
|
|
4904
4968
|
OrganizationPointProviderSchema,
|
|
4905
4969
|
OrganizationPointTypeSchema,
|
|
@@ -4908,7 +4972,10 @@ export {
|
|
|
4908
4972
|
OrganizationProductWebhookSchema,
|
|
4909
4973
|
OrganizationProductWebhookUpsertResponseSchema,
|
|
4910
4974
|
OrganizationSchema,
|
|
4975
|
+
OrganizationVoucherCommandResultSchema,
|
|
4911
4976
|
OrganizationVoucherCommandSchema,
|
|
4977
|
+
OrganizationVoucherIssueCommandResultSchema,
|
|
4978
|
+
OrganizationVoucherLookupCommandResultSchema,
|
|
4912
4979
|
OrganizationVoucherProviderSchema,
|
|
4913
4980
|
OrganizationVoucherProviderSecretInputSchema,
|
|
4914
4981
|
OrganizationVoucherProviderSecretNameSchema,
|
|
@@ -4934,6 +5001,7 @@ export {
|
|
|
4934
5001
|
RequestSourceManagedMemberRenewalSchema,
|
|
4935
5002
|
RequestSourceManagedMemberUpdateSchema,
|
|
4936
5003
|
RequestVoucherIssueSchema,
|
|
5004
|
+
RequestVoucherLookupSchema,
|
|
4937
5005
|
ServiceClientSchema,
|
|
4938
5006
|
SortDirectionSchema,
|
|
4939
5007
|
SourceManagedMemberLookupBySchema,
|