@spoketech/hub-client 0.1.11 → 0.1.13
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 +1265 -273
- package/dist/index.js +62 -3
- 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",
|
|
@@ -144,6 +144,12 @@ var NullableString = Schema2.Union(Schema2.String, Schema2.Null);
|
|
|
144
144
|
var OptionalNullableString = Schema2.optional(NullableString);
|
|
145
145
|
var NullableNumber = Schema2.Union(Schema2.Number, Schema2.Null);
|
|
146
146
|
var OptionalNullableNumber = Schema2.optional(NullableNumber);
|
|
147
|
+
var LookupCacheTtlMsSchema = Schema2.optional(
|
|
148
|
+
Schema2.Number.annotations({
|
|
149
|
+
description: "Maximum age in milliseconds for reusing a completed matching lookup command instead of calling the onsite client. Omit or set to 0 to always request a fresh onsite lookup.",
|
|
150
|
+
example: 3e4
|
|
151
|
+
})
|
|
152
|
+
);
|
|
147
153
|
var JsonObjectSchema = Schema2.Record({
|
|
148
154
|
key: Schema2.String,
|
|
149
155
|
value: Schema2.Unknown
|
|
@@ -282,6 +288,20 @@ var OrganizationVoucherProviderSchema = Schema2.Struct({
|
|
|
282
288
|
updatedAt: TimestampSchema,
|
|
283
289
|
deletedAt: Schema2.Union(TimestampSchema, Schema2.Null)
|
|
284
290
|
});
|
|
291
|
+
var OrganizationVoucherIssueCommandResultSchema = Schema2.Struct({
|
|
292
|
+
externalMemberId: NullableString,
|
|
293
|
+
memberCode: NullableString,
|
|
294
|
+
externalRewardId: NullableString,
|
|
295
|
+
externalGuid: NullableString,
|
|
296
|
+
rawRecord: Schema2.optional(Schema2.Unknown)
|
|
297
|
+
});
|
|
298
|
+
var OrganizationVoucherLookupCommandResultSchema = Schema2.Struct({
|
|
299
|
+
vouchers: Schema2.Array(JsonObjectSchema)
|
|
300
|
+
});
|
|
301
|
+
var OrganizationVoucherCommandResultSchema = Schema2.Union(
|
|
302
|
+
OrganizationVoucherIssueCommandResultSchema,
|
|
303
|
+
OrganizationVoucherLookupCommandResultSchema
|
|
304
|
+
);
|
|
285
305
|
var OrganizationVoucherCommandSchema = Schema2.Struct({
|
|
286
306
|
id: Schema2.String,
|
|
287
307
|
organizationId: Schema2.String,
|
|
@@ -290,7 +310,7 @@ var OrganizationVoucherCommandSchema = Schema2.Struct({
|
|
|
290
310
|
kind: Schema2.Literal(...organizationVoucherCommandKinds),
|
|
291
311
|
status: Schema2.Literal(...organizationVoucherCommandStatuses),
|
|
292
312
|
payload: JsonObjectSchema,
|
|
293
|
-
result: Schema2.Union(
|
|
313
|
+
result: Schema2.Union(OrganizationVoucherCommandResultSchema, Schema2.Null),
|
|
294
314
|
errorMessage: NullableString,
|
|
295
315
|
requestedAt: TimestampSchema,
|
|
296
316
|
acceptedAt: Schema2.Union(TimestampSchema, Schema2.Null),
|
|
@@ -314,10 +334,18 @@ var RequestVoucherIssueSchema = Schema2.Struct({
|
|
|
314
334
|
quantity: Schema2.optional(Schema2.Number),
|
|
315
335
|
metadata: Schema2.optional(JsonObjectSchema)
|
|
316
336
|
});
|
|
337
|
+
var RequestVoucherLookupSchema = Schema2.Struct({
|
|
338
|
+
memberId: Schema2.optional(Schema2.String),
|
|
339
|
+
externalSystemMemberId: OptionalNullableString,
|
|
340
|
+
memberNumber: OptionalNullableString,
|
|
341
|
+
cacheTtlMs: LookupCacheTtlMsSchema,
|
|
342
|
+
metadata: Schema2.optional(JsonObjectSchema)
|
|
343
|
+
});
|
|
317
344
|
var OnsiteVoucherCommandSchema = Schema2.Struct({
|
|
318
345
|
commandId: Schema2.String,
|
|
319
346
|
organizationId: Schema2.String,
|
|
320
347
|
organizationVoucherProviderId: Schema2.String,
|
|
348
|
+
kind: Schema2.Literal(...organizationVoucherCommandKinds),
|
|
321
349
|
provider: Schema2.Literal(...organizationVoucherProviderProviders),
|
|
322
350
|
transport: Schema2.Literal(...organizationVoucherProviderTransports),
|
|
323
351
|
requestedAt: TimestampSchema,
|
|
@@ -326,8 +354,11 @@ var OnsiteVoucherCommandSchema = Schema2.Struct({
|
|
|
326
354
|
secrets: Schema2.Array(OrganizationVoucherProviderSecretInputSchema)
|
|
327
355
|
});
|
|
328
356
|
var CompleteOnsiteVoucherCommandSchema = Schema2.Struct({
|
|
357
|
+
externalMemberId: OptionalNullableString,
|
|
358
|
+
memberCode: OptionalNullableString,
|
|
329
359
|
externalRewardId: OptionalNullableString,
|
|
330
360
|
externalGuid: OptionalNullableString,
|
|
361
|
+
vouchers: Schema2.optional(Schema2.Array(JsonObjectSchema)),
|
|
331
362
|
rawRecord: Schema2.optional(Schema2.Unknown),
|
|
332
363
|
errorMessage: OptionalNullableString
|
|
333
364
|
});
|
|
@@ -388,6 +419,7 @@ var RequestPointLookupSchema = Schema2.Struct({
|
|
|
388
419
|
cardData: OptionalNullableString,
|
|
389
420
|
account: Schema2.optional(Schema2.Union(Schema2.String, Schema2.Number)),
|
|
390
421
|
packetNumber: Schema2.optional(Schema2.Union(Schema2.String, Schema2.Number)),
|
|
422
|
+
cacheTtlMs: LookupCacheTtlMsSchema,
|
|
391
423
|
metadata: Schema2.optional(JsonObjectSchema)
|
|
392
424
|
});
|
|
393
425
|
var RequestPointDebitSchema = Schema2.Struct({
|
|
@@ -2868,6 +2900,11 @@ var OnsiteResourceCallRequestSchema = Schema2.Union(
|
|
|
2868
2900
|
waitMs: OnsiteResourceCallWaitMsSchema,
|
|
2869
2901
|
payload: RequestVoucherIssueSchema
|
|
2870
2902
|
}),
|
|
2903
|
+
Schema2.Struct({
|
|
2904
|
+
operation: Schema2.Literal("voucher.lookup"),
|
|
2905
|
+
waitMs: OnsiteResourceCallWaitMsSchema,
|
|
2906
|
+
payload: RequestVoucherLookupSchema
|
|
2907
|
+
}),
|
|
2871
2908
|
Schema2.Struct({
|
|
2872
2909
|
operation: Schema2.Literal("points.lookup"),
|
|
2873
2910
|
waitMs: OnsiteResourceCallWaitMsSchema,
|
|
@@ -2898,7 +2935,7 @@ var OnsiteResourceMemberCallResponseSchema = Schema2.Struct({
|
|
|
2898
2935
|
});
|
|
2899
2936
|
var OnsiteResourceVoucherCallResponseSchema = Schema2.Struct({
|
|
2900
2937
|
kind: Schema2.Literal("voucher"),
|
|
2901
|
-
operation: Schema2.Literal("voucher.issue"),
|
|
2938
|
+
operation: Schema2.Literal("voucher.issue", "voucher.lookup"),
|
|
2902
2939
|
settled: Schema2.Boolean,
|
|
2903
2940
|
timedOut: Schema2.Boolean,
|
|
2904
2941
|
command: OrganizationVoucherCommandSchema
|
|
@@ -3522,6 +3559,12 @@ var vouchersGroup = HttpApiGroup.make("vouchers").add(
|
|
|
3522
3559
|
summary: "Request a voucher issue through the onsite voucher client"
|
|
3523
3560
|
})
|
|
3524
3561
|
)
|
|
3562
|
+
).add(
|
|
3563
|
+
HttpApiEndpoint.post("requestVoucherLookup", "/organizations/:organizationId/vouchers/lookup").setPath(OrganizationIdParams).setPayload(RequestVoucherLookupSchema).addSuccess(OrganizationVoucherCommandSchema, { status: 202 }).annotateContext(
|
|
3564
|
+
OpenApi.annotations({
|
|
3565
|
+
summary: "Request a voucher lookup through the onsite voucher client"
|
|
3566
|
+
})
|
|
3567
|
+
)
|
|
3525
3568
|
).add(
|
|
3526
3569
|
HttpApiEndpoint.get(
|
|
3527
3570
|
"getOrganizationVoucherCommand",
|
|
@@ -4324,6 +4367,12 @@ function makeOnsiteResourceClient(client) {
|
|
|
4324
4367
|
waitMs: input.waitMs,
|
|
4325
4368
|
operation: "voucher.issue",
|
|
4326
4369
|
payload: input.payload
|
|
4370
|
+
}),
|
|
4371
|
+
lookup: (input) => call({
|
|
4372
|
+
organizationId: input.organizationId,
|
|
4373
|
+
waitMs: input.waitMs,
|
|
4374
|
+
operation: "voucher.lookup",
|
|
4375
|
+
payload: input.payload
|
|
4327
4376
|
})
|
|
4328
4377
|
},
|
|
4329
4378
|
points: {
|
|
@@ -4772,6 +4821,12 @@ function makeSpokeClient(hubClient) {
|
|
|
4772
4821
|
path: { organizationId: input.organizationId },
|
|
4773
4822
|
payload: input.payload
|
|
4774
4823
|
})
|
|
4824
|
+
),
|
|
4825
|
+
requestLookup: (input) => unwrap(
|
|
4826
|
+
hubClient.vouchers.requestVoucherLookup({
|
|
4827
|
+
path: { organizationId: input.organizationId },
|
|
4828
|
+
payload: input.payload
|
|
4829
|
+
})
|
|
4775
4830
|
)
|
|
4776
4831
|
},
|
|
4777
4832
|
guests: {
|
|
@@ -4925,7 +4980,10 @@ export {
|
|
|
4925
4980
|
OrganizationProductWebhookSchema,
|
|
4926
4981
|
OrganizationProductWebhookUpsertResponseSchema,
|
|
4927
4982
|
OrganizationSchema,
|
|
4983
|
+
OrganizationVoucherCommandResultSchema,
|
|
4928
4984
|
OrganizationVoucherCommandSchema,
|
|
4985
|
+
OrganizationVoucherIssueCommandResultSchema,
|
|
4986
|
+
OrganizationVoucherLookupCommandResultSchema,
|
|
4929
4987
|
OrganizationVoucherProviderSchema,
|
|
4930
4988
|
OrganizationVoucherProviderSecretInputSchema,
|
|
4931
4989
|
OrganizationVoucherProviderSecretNameSchema,
|
|
@@ -4951,6 +5009,7 @@ export {
|
|
|
4951
5009
|
RequestSourceManagedMemberRenewalSchema,
|
|
4952
5010
|
RequestSourceManagedMemberUpdateSchema,
|
|
4953
5011
|
RequestVoucherIssueSchema,
|
|
5012
|
+
RequestVoucherLookupSchema,
|
|
4954
5013
|
ServiceClientSchema,
|
|
4955
5014
|
SortDirectionSchema,
|
|
4956
5015
|
SourceManagedMemberLookupBySchema,
|