@tinycloud/share-sdk 1.0.0-beta.9 → 1.0.1-beta.0

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.cjs CHANGED
@@ -5280,11 +5280,15 @@ var contentMetadataSchema = external_exports.object({
5280
5280
  /** Encrypted presentation discriminator. The fixed entry point is index.html. */
5281
5281
  artifact: external_exports.literal("html").optional()
5282
5282
  }).strict();
5283
+ var deliveryEmailSchema = external_exports.string().email();
5284
+ function isEnvelopeDeliveryEmail(value) {
5285
+ return deliveryEmailSchema.safeParse(value).success;
5286
+ }
5283
5287
  var unsignedShareEnvelopeV2BaseSchema = external_exports.object({
5284
5288
  version: external_exports.literal(2),
5285
5289
  shareId: external_exports.string().min(1),
5286
5290
  recipientMatcher: recipientMatcherSchema,
5287
- deliveryEmail: external_exports.string().email().optional(),
5291
+ deliveryEmail: deliveryEmailSchema.optional(),
5288
5292
  actions: external_exports.array(shareActionSchema).min(1).max(3),
5289
5293
  resource: resourceSelectorSchema,
5290
5294
  target: v2TargetSchema,
@@ -5424,7 +5428,7 @@ var unsignedShareEnvelopeV3BaseSchema = external_exports.object({
5424
5428
  version: external_exports.literal(3),
5425
5429
  shareId: external_exports.string().min(1),
5426
5430
  recipientMatcher: recipientMatcherSchema,
5427
- deliveryEmail: external_exports.string().email().optional(),
5431
+ deliveryEmail: deliveryEmailSchema.optional(),
5428
5432
  actions: external_exports.array(shareActionSchema).min(1).max(3),
5429
5433
  resource: resourceSelectorSchema,
5430
5434
  target: v3TargetSchema,
@@ -6797,6 +6801,7 @@ function prepareAddressedShare(request) {
6797
6801
  }
6798
6802
  if (request.actions.length === 0 || request.policyActions.length === 0) throw new TypeError("addressed share actions are empty");
6799
6803
  if (request.policyActions.some((action) => !OWNER_SHARE_ACTIONS.has(action))) throw new TypeError("addressed share action is not supported");
6804
+ if (request.deliveryEmail !== void 0 && !isEnvelopeDeliveryEmail(request.deliveryEmail)) throw new TypeError("delivery email is not a valid envelope address");
6800
6805
  const target = normalizeShareTarget(request.target);
6801
6806
  if (target.kind === "bearer") throw new TypeError("addressed target is required");
6802
6807
  if (target.kind === "recipientDid") return { target };