apps 0.0.1-beta.83 → 0.0.1-beta.84

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/js/openapi.js CHANGED
@@ -5004,19 +5004,21 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
5004
5004
  } catch (error) {
5005
5005
  if (!(error instanceof OpenapiCompileError)) throw error;
5006
5006
  }
5007
- let pinnedOrigin = options.allowedOrigin;
5008
- for (const [origin, count] of options.allowedOrigin === void 0 ? counts : []) {
5009
- const best = pinnedOrigin === void 0 ? 0 : counts.get(pinnedOrigin) ?? 0;
5010
- if (count > best || count === best && origin === documentOrigin) pinnedOrigin = origin;
5007
+ const allowed = options.allowedOrigin === void 0 ? void 0 : typeof options.allowedOrigin === "string" ? [options.allowedOrigin] : options.allowedOrigin;
5008
+ let mostUsed;
5009
+ for (const [origin, count] of allowed === void 0 ? counts : []) {
5010
+ const best = mostUsed === void 0 ? 0 : counts.get(mostUsed) ?? 0;
5011
+ if (count > best || count === best && origin === documentOrigin) mostUsed = origin;
5011
5012
  }
5013
+ const pinnedOrigins = new Set(allowed ?? (mostUsed === void 0 ? [] : [mostUsed]));
5012
5014
  const imported = [];
5013
5015
  for (const { operation, methods: operationMethods, declared } of built) {
5014
5016
  const origin = new URL(operation.baseUrl).origin;
5015
- if (origin !== pinnedOrigin) {
5017
+ if (!pinnedOrigins.has(origin)) {
5016
5018
  skipped.push({
5017
5019
  ...declared,
5018
5020
  code: "multiple_hosts",
5019
- reason: options.allowedOrigin === void 0 ? `Its server origin ${origin} differs from ${pinnedOrigin ?? "the origin"} most operations use.` : `Its server origin ${origin} is not allowedOrigin ${options.allowedOrigin}.`
5021
+ reason: allowed === void 0 ? `Its server origin ${origin} differs from ${mostUsed ?? "the origin"} most operations use.` : `Its server origin ${origin} is not allowedOrigin ${allowed.join(", ")}.`
5020
5022
  });
5021
5023
  continue;
5022
5024
  }
@@ -5026,10 +5028,10 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
5026
5028
  const operations = imported.map(({ operation }) => operation);
5027
5029
  if (!operations.length) {
5028
5030
  const left = inDefinitionOrder(skipped);
5029
- if (options.allowedOrigin !== void 0 && built.length > 0)
5031
+ if (allowed !== void 0 && built.length > 0)
5030
5032
  throw new OpenapiCompileError({
5031
5033
  code: "no_supported_operations",
5032
- reason: `allowedOrigin ${options.allowedOrigin} is not the origin of any operation. They resolve to ${[...counts.keys()].join(", ")}. Set allowedOrigin to the origin that receives the account's credentials, or set baseUrl.`,
5034
+ reason: `allowedOrigin ${allowed.join(", ")} is not the origin of any operation. They resolve to ${[...counts.keys()].join(", ")}. Set allowedOrigin to the origin that receives the account's credentials, or set baseUrl.`,
5033
5035
  skipped: left,
5034
5036
  origins: [...counts.keys()]
5035
5037
  });
@@ -5094,7 +5096,7 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
5094
5096
  secrets: [...methods.values()],
5095
5097
  oauth,
5096
5098
  schemes,
5097
- pinnedOrigin,
5099
+ pinnedOrigins: [...pinnedOrigins],
5098
5100
  fallback
5099
5101
  };
5100
5102
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.0.1-beta.83",
3
+ "version": "0.0.1-beta.84",
4
4
  "description": "TypeScript apps with typed tools, accounts, storage, and UI.",
5
5
  "type": "module",
6
6
  "sideEffects": false,