@tinycloud/share-sdk 1.0.0 → 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.js CHANGED
@@ -5197,11 +5197,15 @@ var contentMetadataSchema = external_exports.object({
5197
5197
  /** Encrypted presentation discriminator. The fixed entry point is index.html. */
5198
5198
  artifact: external_exports.literal("html").optional()
5199
5199
  }).strict();
5200
+ var deliveryEmailSchema = external_exports.string().email();
5201
+ function isEnvelopeDeliveryEmail(value) {
5202
+ return deliveryEmailSchema.safeParse(value).success;
5203
+ }
5200
5204
  var unsignedShareEnvelopeV2BaseSchema = external_exports.object({
5201
5205
  version: external_exports.literal(2),
5202
5206
  shareId: external_exports.string().min(1),
5203
5207
  recipientMatcher: recipientMatcherSchema,
5204
- deliveryEmail: external_exports.string().email().optional(),
5208
+ deliveryEmail: deliveryEmailSchema.optional(),
5205
5209
  actions: external_exports.array(shareActionSchema).min(1).max(3),
5206
5210
  resource: resourceSelectorSchema,
5207
5211
  target: v2TargetSchema,
@@ -5341,7 +5345,7 @@ var unsignedShareEnvelopeV3BaseSchema = external_exports.object({
5341
5345
  version: external_exports.literal(3),
5342
5346
  shareId: external_exports.string().min(1),
5343
5347
  recipientMatcher: recipientMatcherSchema,
5344
- deliveryEmail: external_exports.string().email().optional(),
5348
+ deliveryEmail: deliveryEmailSchema.optional(),
5345
5349
  actions: external_exports.array(shareActionSchema).min(1).max(3),
5346
5350
  resource: resourceSelectorSchema,
5347
5351
  target: v3TargetSchema,
@@ -6714,6 +6718,7 @@ function prepareAddressedShare(request) {
6714
6718
  }
6715
6719
  if (request.actions.length === 0 || request.policyActions.length === 0) throw new TypeError("addressed share actions are empty");
6716
6720
  if (request.policyActions.some((action) => !OWNER_SHARE_ACTIONS.has(action))) throw new TypeError("addressed share action is not supported");
6721
+ if (request.deliveryEmail !== void 0 && !isEnvelopeDeliveryEmail(request.deliveryEmail)) throw new TypeError("delivery email is not a valid envelope address");
6717
6722
  const target = normalizeShareTarget(request.target);
6718
6723
  if (target.kind === "bearer") throw new TypeError("addressed target is required");
6719
6724
  if (target.kind === "recipientDid") return { target };