@spoketech/hub-client 0.1.11 → 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.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(JsonObjectSchema, Schema2.Null),
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
  });
@@ -2868,6 +2892,11 @@ var OnsiteResourceCallRequestSchema = Schema2.Union(
2868
2892
  waitMs: OnsiteResourceCallWaitMsSchema,
2869
2893
  payload: RequestVoucherIssueSchema
2870
2894
  }),
2895
+ Schema2.Struct({
2896
+ operation: Schema2.Literal("voucher.lookup"),
2897
+ waitMs: OnsiteResourceCallWaitMsSchema,
2898
+ payload: RequestVoucherLookupSchema
2899
+ }),
2871
2900
  Schema2.Struct({
2872
2901
  operation: Schema2.Literal("points.lookup"),
2873
2902
  waitMs: OnsiteResourceCallWaitMsSchema,
@@ -2898,7 +2927,7 @@ var OnsiteResourceMemberCallResponseSchema = Schema2.Struct({
2898
2927
  });
2899
2928
  var OnsiteResourceVoucherCallResponseSchema = Schema2.Struct({
2900
2929
  kind: Schema2.Literal("voucher"),
2901
- operation: Schema2.Literal("voucher.issue"),
2930
+ operation: Schema2.Literal("voucher.issue", "voucher.lookup"),
2902
2931
  settled: Schema2.Boolean,
2903
2932
  timedOut: Schema2.Boolean,
2904
2933
  command: OrganizationVoucherCommandSchema
@@ -3522,6 +3551,12 @@ var vouchersGroup = HttpApiGroup.make("vouchers").add(
3522
3551
  summary: "Request a voucher issue through the onsite voucher client"
3523
3552
  })
3524
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
+ )
3525
3560
  ).add(
3526
3561
  HttpApiEndpoint.get(
3527
3562
  "getOrganizationVoucherCommand",
@@ -4324,6 +4359,12 @@ function makeOnsiteResourceClient(client) {
4324
4359
  waitMs: input.waitMs,
4325
4360
  operation: "voucher.issue",
4326
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
4327
4368
  })
4328
4369
  },
4329
4370
  points: {
@@ -4772,6 +4813,12 @@ function makeSpokeClient(hubClient) {
4772
4813
  path: { organizationId: input.organizationId },
4773
4814
  payload: input.payload
4774
4815
  })
4816
+ ),
4817
+ requestLookup: (input) => unwrap(
4818
+ hubClient.vouchers.requestVoucherLookup({
4819
+ path: { organizationId: input.organizationId },
4820
+ payload: input.payload
4821
+ })
4775
4822
  )
4776
4823
  },
4777
4824
  guests: {
@@ -4925,7 +4972,10 @@ export {
4925
4972
  OrganizationProductWebhookSchema,
4926
4973
  OrganizationProductWebhookUpsertResponseSchema,
4927
4974
  OrganizationSchema,
4975
+ OrganizationVoucherCommandResultSchema,
4928
4976
  OrganizationVoucherCommandSchema,
4977
+ OrganizationVoucherIssueCommandResultSchema,
4978
+ OrganizationVoucherLookupCommandResultSchema,
4929
4979
  OrganizationVoucherProviderSchema,
4930
4980
  OrganizationVoucherProviderSecretInputSchema,
4931
4981
  OrganizationVoucherProviderSecretNameSchema,
@@ -4951,6 +5001,7 @@ export {
4951
5001
  RequestSourceManagedMemberRenewalSchema,
4952
5002
  RequestSourceManagedMemberUpdateSchema,
4953
5003
  RequestVoucherIssueSchema,
5004
+ RequestVoucherLookupSchema,
4954
5005
  ServiceClientSchema,
4955
5006
  SortDirectionSchema,
4956
5007
  SourceManagedMemberLookupBySchema,