@vxrn/utils 2.0.0-beta.123.1 → 2.0.0-beta.128.1

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.
@@ -61,11 +61,33 @@ function validateNativeApp(manifest, platform) {
61
61
  if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== "string" || manifest.contacts.usage.trim() === "")) {
62
62
  fail("contacts.usage must be a non-empty string");
63
63
  }
64
+ if (manifest.calendar !== void 0) {
65
+ if (!manifest.calendar || manifest.calendar.usage === void 0 && manifest.calendar.remindersUsage === void 0) {
66
+ fail("calendar.usage or calendar.remindersUsage must be a non-empty string");
67
+ }
68
+ if (manifest.calendar.usage !== void 0 && (typeof manifest.calendar.usage !== "string" || manifest.calendar.usage.trim() === "")) {
69
+ fail("calendar.usage must be a non-empty string");
70
+ }
71
+ if (manifest.calendar.remindersUsage !== void 0 && (typeof manifest.calendar.remindersUsage !== "string" || manifest.calendar.remindersUsage.trim() === "")) {
72
+ fail("calendar.remindersUsage must be a non-empty string");
73
+ }
74
+ }
64
75
  if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== "string" || manifest.location.whenInUse.trim() === "")) {
65
76
  fail("location.whenInUse must be a non-empty string");
66
77
  }
67
- if (manifest.audio !== void 0 && (!manifest.audio || typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
68
- fail("audio.microphone must be a non-empty string");
78
+ if (manifest.audio !== void 0) {
79
+ if (!manifest.audio || typeof manifest.audio !== "object") {
80
+ fail("audio must configure microphone or background playback");
81
+ }
82
+ if (manifest.audio.microphone !== void 0 && (typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
83
+ fail("audio.microphone must be a non-empty string");
84
+ }
85
+ if (manifest.audio.background !== void 0 && typeof manifest.audio.background !== "boolean") {
86
+ fail("audio.background must be a boolean");
87
+ }
88
+ if (manifest.audio.microphone === void 0 && manifest.audio.background !== true) {
89
+ fail("audio must configure microphone or background playback");
90
+ }
69
91
  }
70
92
  if (manifest.ios?.faceIdUsageDescription !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== "string" || manifest.ios.faceIdUsageDescription.trim() === "")) {
71
93
  fail("ios.faceIdUsageDescription must be a non-empty string");
@@ -81,11 +81,33 @@ function validateNativeApp(manifest, platform) {
81
81
  if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== "string" || manifest.contacts.usage.trim() === "")) {
82
82
  fail("contacts.usage must be a non-empty string");
83
83
  }
84
+ if (manifest.calendar !== void 0) {
85
+ if (!manifest.calendar || manifest.calendar.usage === void 0 && manifest.calendar.remindersUsage === void 0) {
86
+ fail("calendar.usage or calendar.remindersUsage must be a non-empty string");
87
+ }
88
+ if (manifest.calendar.usage !== void 0 && (typeof manifest.calendar.usage !== "string" || manifest.calendar.usage.trim() === "")) {
89
+ fail("calendar.usage must be a non-empty string");
90
+ }
91
+ if (manifest.calendar.remindersUsage !== void 0 && (typeof manifest.calendar.remindersUsage !== "string" || manifest.calendar.remindersUsage.trim() === "")) {
92
+ fail("calendar.remindersUsage must be a non-empty string");
93
+ }
94
+ }
84
95
  if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== "string" || manifest.location.whenInUse.trim() === "")) {
85
96
  fail("location.whenInUse must be a non-empty string");
86
97
  }
87
- if (manifest.audio !== void 0 && (!manifest.audio || typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
88
- fail("audio.microphone must be a non-empty string");
98
+ if (manifest.audio !== void 0) {
99
+ if (!manifest.audio || typeof manifest.audio !== "object") {
100
+ fail("audio must configure microphone or background playback");
101
+ }
102
+ if (manifest.audio.microphone !== void 0 && (typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
103
+ fail("audio.microphone must be a non-empty string");
104
+ }
105
+ if (manifest.audio.background !== void 0 && typeof manifest.audio.background !== "boolean") {
106
+ fail("audio.background must be a boolean");
107
+ }
108
+ if (manifest.audio.microphone === void 0 && manifest.audio.background !== true) {
109
+ fail("audio must configure microphone or background playback");
110
+ }
89
111
  }
90
112
  if (((_manifest_ios = manifest.ios) === null || _manifest_ios === void 0 ? void 0 : _manifest_ios.faceIdUsageDescription) !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== "string" || manifest.ios.faceIdUsageDescription.trim() === "")) {
91
113
  fail("ios.faceIdUsageDescription must be a non-empty string");
@@ -81,11 +81,33 @@ function validateNativeApp(manifest, platform) {
81
81
  if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== "string" || manifest.contacts.usage.trim() === "")) {
82
82
  fail("contacts.usage must be a non-empty string");
83
83
  }
84
+ if (manifest.calendar !== void 0) {
85
+ if (!manifest.calendar || manifest.calendar.usage === void 0 && manifest.calendar.remindersUsage === void 0) {
86
+ fail("calendar.usage or calendar.remindersUsage must be a non-empty string");
87
+ }
88
+ if (manifest.calendar.usage !== void 0 && (typeof manifest.calendar.usage !== "string" || manifest.calendar.usage.trim() === "")) {
89
+ fail("calendar.usage must be a non-empty string");
90
+ }
91
+ if (manifest.calendar.remindersUsage !== void 0 && (typeof manifest.calendar.remindersUsage !== "string" || manifest.calendar.remindersUsage.trim() === "")) {
92
+ fail("calendar.remindersUsage must be a non-empty string");
93
+ }
94
+ }
84
95
  if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== "string" || manifest.location.whenInUse.trim() === "")) {
85
96
  fail("location.whenInUse must be a non-empty string");
86
97
  }
87
- if (manifest.audio !== void 0 && (!manifest.audio || typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
88
- fail("audio.microphone must be a non-empty string");
98
+ if (manifest.audio !== void 0) {
99
+ if (!manifest.audio || typeof manifest.audio !== "object") {
100
+ fail("audio must configure microphone or background playback");
101
+ }
102
+ if (manifest.audio.microphone !== void 0 && (typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
103
+ fail("audio.microphone must be a non-empty string");
104
+ }
105
+ if (manifest.audio.background !== void 0 && typeof manifest.audio.background !== "boolean") {
106
+ fail("audio.background must be a boolean");
107
+ }
108
+ if (manifest.audio.microphone === void 0 && manifest.audio.background !== true) {
109
+ fail("audio must configure microphone or background playback");
110
+ }
89
111
  }
90
112
  if (((_manifest_ios = manifest.ios) === null || _manifest_ios === void 0 ? void 0 : _manifest_ios.faceIdUsageDescription) !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== "string" || manifest.ios.faceIdUsageDescription.trim() === "")) {
91
113
  fail("ios.faceIdUsageDescription must be a non-empty string");
@@ -1 +1 @@
1
- {"version":3,"file":"nativeAppManifest.native.js","names":[],"sources":["cjs/nativeAppManifest.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar nativeAppManifest_exports = {};\n__export(nativeAppManifest_exports, {\n validateNativeApp: () => validateNativeApp\n});\nmodule.exports = __toCommonJS(nativeAppManifest_exports);\nvar TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;\nvar SCHEME = /^[a-z][a-z0-9+.-]*$/i;\nvar VERSION = /^\\d+\\.\\d+\\.\\d+/;\nvar BUILD_NUMBER = /^[A-Za-z0-9.]+$/;\nvar REVERSE_DNS = /^[A-Za-z][A-Za-z0-9-]*(\\.[A-Za-z][A-Za-z0-9-]*)+$/;\nvar DEPLOYMENT_TARGET = /^\\d+\\.\\d+$/;\nvar HEX_COLOR = /^#[\\da-f]{6}$/i;\nfunction fail(message) {\n throw new Error(`[one] invalid native.app: ${message}`);\n}\nfunction validateNativeApp(manifest, platform) {\n var _manifest_imagePicker, _manifest_ios, _manifest_speech;\n if (!manifest || typeof manifest !== \"object\") fail(\"manifest must be an object\");\n if (!manifest.name || typeof manifest.name !== \"string\") fail(\"name is required\");\n if (!TARGET_NAME.test(manifest.name)) {\n fail(`name \"${manifest.name}\" must start with a letter and contain only letters, digits, and underscore`);\n }\n var schemes = manifest.scheme === void 0 ? [] : Array.isArray(manifest.scheme) ? manifest.scheme : [\n manifest.scheme\n ];\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = schemes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var scheme = _step.value;\n if (typeof scheme !== \"string\" || !SCHEME.test(scheme)) {\n fail(`scheme \"${scheme}\" must be a valid uri scheme`);\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (manifest.version !== void 0 && !VERSION.test(manifest.version)) {\n fail(`version \"${manifest.version}\" must start with major.minor.patch`);\n }\n if (manifest.icon !== void 0 && (!manifest.icon.source || !HEX_COLOR.test(manifest.icon.backgroundColor))) {\n fail(\"icon requires source and a six-digit hex backgroundColor\");\n }\n if (manifest.splash !== void 0 && (!manifest.splash.source || !HEX_COLOR.test(manifest.splash.backgroundColor) || manifest.splash.width !== void 0 && (!Number.isFinite(manifest.splash.width) || manifest.splash.width < 1 || manifest.splash.width > 288))) {\n fail(\"splash requires source, a six-digit hex backgroundColor, and width from 1 to 288\");\n }\n if (((_manifest_imagePicker = manifest.imagePicker) === null || _manifest_imagePicker === void 0 ? void 0 : _manifest_imagePicker.camera) !== void 0 && (typeof manifest.imagePicker.camera !== \"string\" || manifest.imagePicker.camera.trim() === \"\")) {\n fail(\"imagePicker.camera must be a non-empty string\");\n }\n if (manifest.photoLibrary !== void 0 && (!manifest.photoLibrary || typeof manifest.photoLibrary.addOnly !== \"string\" || manifest.photoLibrary.addOnly.trim() === \"\")) {\n fail(\"photoLibrary.addOnly must be a non-empty string\");\n }\n if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== \"string\" || manifest.contacts.usage.trim() === \"\")) {\n fail(\"contacts.usage must be a non-empty string\");\n }\n if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== \"string\" || manifest.location.whenInUse.trim() === \"\")) {\n fail(\"location.whenInUse must be a non-empty string\");\n }\n if (manifest.audio !== void 0 && (!manifest.audio || typeof manifest.audio.microphone !== \"string\" || manifest.audio.microphone.trim() === \"\")) {\n fail(\"audio.microphone must be a non-empty string\");\n }\n if (((_manifest_ios = manifest.ios) === null || _manifest_ios === void 0 ? void 0 : _manifest_ios.faceIdUsageDescription) !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== \"string\" || manifest.ios.faceIdUsageDescription.trim() === \"\")) {\n fail(\"ios.faceIdUsageDescription must be a non-empty string\");\n }\n if (manifest.speech !== void 0 && (typeof ((_manifest_speech = manifest.speech) === null || _manifest_speech === void 0 ? void 0 : _manifest_speech.recognition) !== \"string\" || manifest.speech.recognition.trim() === \"\" || typeof manifest.speech.microphone !== \"string\" || manifest.speech.microphone.trim() === \"\")) {\n fail(\"speech.recognition and speech.microphone must be non-empty strings\");\n }\n if (manifest.notifications !== void 0) {\n if (typeof manifest.notifications !== \"object\" || manifest.notifications.push !== void 0 && typeof manifest.notifications.push !== \"boolean\") {\n fail(\"notifications.push must be a boolean\");\n }\n }\n if (manifest.pictureInPicture !== void 0 && typeof manifest.pictureInPicture !== \"boolean\") {\n fail(\"pictureInPicture must be a boolean\");\n }\n if (manifest.updates !== void 0) {\n if (typeof manifest.updates.runtimeVersion !== \"string\" || manifest.updates.runtimeVersion.trim() === \"\") {\n fail(\"updates.runtimeVersion must be a non-empty string\");\n }\n if (manifest.updates.url !== void 0 && (typeof manifest.updates.url !== \"string\" || manifest.updates.url.trim() === \"\")) {\n fail(\"updates.url must be a non-empty string\");\n }\n }\n if (!platform || platform === \"ios\") {\n var _manifest_ios1;\n if (!((_manifest_ios1 = manifest.ios) === null || _manifest_ios1 === void 0 ? void 0 : _manifest_ios1.bundleId) || !REVERSE_DNS.test(manifest.ios.bundleId)) {\n var _manifest_ios2;\n fail(`ios.bundleId \"${(_manifest_ios2 = manifest.ios) === null || _manifest_ios2 === void 0 ? void 0 : _manifest_ios2.bundleId}\" must be reverse-dns`);\n }\n if (manifest.ios.deploymentTarget !== void 0 && !DEPLOYMENT_TARGET.test(manifest.ios.deploymentTarget)) {\n fail(`ios.deploymentTarget \"${manifest.ios.deploymentTarget}\" must look like \"17.0\"`);\n }\n if (manifest.ios.buildNumber !== void 0 && !BUILD_NUMBER.test(manifest.ios.buildNumber)) {\n fail(`ios.buildNumber \"${manifest.ios.buildNumber}\" must contain only letters, digits, and dots`);\n }\n var widgets = manifest.ios.widgets;\n if (widgets) {\n var _widgets_displayName, _widgets_description;\n if (!manifest.ios.deploymentTarget || Number(manifest.ios.deploymentTarget) < 17) {\n fail(\"ios.widgets requires ios.deploymentTarget of 17.0 or newer\");\n }\n if (!/^group\\.[A-Za-z][A-Za-z0-9-]*(\\.[A-Za-z][A-Za-z0-9-]*)+$/.test(widgets.appGroup)) {\n fail(\"ios.widgets.appGroup must be a reverse-dns App Group beginning with group.\");\n }\n if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(widgets.kind)) {\n fail(\"ios.widgets.kind must be a non-empty WidgetKit kind\");\n }\n if (!((_widgets_displayName = widgets.displayName) === null || _widgets_displayName === void 0 ? void 0 : _widgets_displayName.trim()) || !((_widgets_description = widgets.description) === null || _widgets_description === void 0 ? void 0 : _widgets_description.trim())) {\n fail(\"ios.widgets.displayName and description must be non-empty strings\");\n }\n if (widgets.pushNotifications !== void 0 && typeof widgets.pushNotifications !== \"boolean\") {\n fail(\"ios.widgets.pushNotifications must be a boolean\");\n }\n }\n }\n if (!platform || platform === \"android\") {\n var _manifest_android;\n if (!((_manifest_android = manifest.android) === null || _manifest_android === void 0 ? void 0 : _manifest_android.applicationId) || !REVERSE_DNS.test(manifest.android.applicationId)) {\n var _manifest_android1;\n fail(`android.applicationId \"${(_manifest_android1 = manifest.android) === null || _manifest_android1 === void 0 ? void 0 : _manifest_android1.applicationId}\" must be reverse-dns`);\n }\n if (manifest.android.minSdk !== void 0 && (!Number.isInteger(manifest.android.minSdk) || manifest.android.minSdk < 21 || manifest.android.minSdk > 36)) {\n fail(`android.minSdk \"${manifest.android.minSdk}\" must be an integer from 21 to 36`);\n }\n if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {\n fail(`android.versionCode \"${manifest.android.versionCode}\" must be a positive integer`);\n }\n if (manifest.android.googleMapsApiKey !== void 0 && (typeof manifest.android.googleMapsApiKey !== \"string\" || manifest.android.googleMapsApiKey.trim() === \"\")) {\n fail(\"android.googleMapsApiKey must be a non-empty string\");\n }\n }\n return manifest;\n}\n//# sourceMappingURL=nativeAppManifest.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,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,QAAQ,sBAAsB,KAAK,KAAK,OAAO,QAAQ,sBAAsB,WAAW;IAC1F,KAAK,iDAAiD;GACxD;EACF;CACF;CACA,IAAI,CAAC,YAAY,aAAa,WAAW;EACvC,IAAI;EACJ,IAAI,GAAG,oBAAoB,SAAS,aAAa,QAAQ,sBAAsB,KAAK,IAAI,KAAK,IAAI,kBAAkB,kBAAkB,CAAC,YAAY,KAAK,SAAS,QAAQ,aAAa,GAAG;GACtL,IAAI;GACJ,KAAK,2BAA2B,qBAAqB,SAAS,aAAa,QAAQ,uBAAuB,KAAK,IAAI,KAAK,IAAI,mBAAmB,cAAc,sBAAsB;EACrL;EACA,IAAI,SAAS,QAAQ,WAAW,KAAK,MAAM,CAAC,OAAO,UAAU,SAAS,QAAQ,MAAM,KAAK,SAAS,QAAQ,SAAS,MAAM,SAAS,QAAQ,SAAS,KAAK;GACtJ,KAAK,mBAAmB,SAAS,QAAQ,OAAO,mCAAmC;EACrF;EACA,IAAI,SAAS,QAAQ,gBAAgB,KAAK,MAAM,CAAC,OAAO,UAAU,SAAS,QAAQ,WAAW,KAAK,SAAS,QAAQ,cAAc,IAAI;GACpI,KAAK,wBAAwB,SAAS,QAAQ,YAAY,6BAA6B;EACzF;EACA,IAAI,SAAS,QAAQ,qBAAqB,KAAK,MAAM,OAAO,SAAS,QAAQ,qBAAqB,YAAY,SAAS,QAAQ,iBAAiB,KAAK,MAAM,KAAK;GAC9J,KAAK,qDAAqD;EAC5D;CACF;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"nativeAppManifest.native.js","names":[],"sources":["cjs/nativeAppManifest.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar nativeAppManifest_exports = {};\n__export(nativeAppManifest_exports, {\n validateNativeApp: () => validateNativeApp\n});\nmodule.exports = __toCommonJS(nativeAppManifest_exports);\nvar TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;\nvar SCHEME = /^[a-z][a-z0-9+.-]*$/i;\nvar VERSION = /^\\d+\\.\\d+\\.\\d+/;\nvar BUILD_NUMBER = /^[A-Za-z0-9.]+$/;\nvar REVERSE_DNS = /^[A-Za-z][A-Za-z0-9-]*(\\.[A-Za-z][A-Za-z0-9-]*)+$/;\nvar DEPLOYMENT_TARGET = /^\\d+\\.\\d+$/;\nvar HEX_COLOR = /^#[\\da-f]{6}$/i;\nfunction fail(message) {\n throw new Error(`[one] invalid native.app: ${message}`);\n}\nfunction validateNativeApp(manifest, platform) {\n var _manifest_imagePicker, _manifest_ios, _manifest_speech;\n if (!manifest || typeof manifest !== \"object\") fail(\"manifest must be an object\");\n if (!manifest.name || typeof manifest.name !== \"string\") fail(\"name is required\");\n if (!TARGET_NAME.test(manifest.name)) {\n fail(`name \"${manifest.name}\" must start with a letter and contain only letters, digits, and underscore`);\n }\n var schemes = manifest.scheme === void 0 ? [] : Array.isArray(manifest.scheme) ? manifest.scheme : [\n manifest.scheme\n ];\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = schemes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var scheme = _step.value;\n if (typeof scheme !== \"string\" || !SCHEME.test(scheme)) {\n fail(`scheme \"${scheme}\" must be a valid uri scheme`);\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (manifest.version !== void 0 && !VERSION.test(manifest.version)) {\n fail(`version \"${manifest.version}\" must start with major.minor.patch`);\n }\n if (manifest.icon !== void 0 && (!manifest.icon.source || !HEX_COLOR.test(manifest.icon.backgroundColor))) {\n fail(\"icon requires source and a six-digit hex backgroundColor\");\n }\n if (manifest.splash !== void 0 && (!manifest.splash.source || !HEX_COLOR.test(manifest.splash.backgroundColor) || manifest.splash.width !== void 0 && (!Number.isFinite(manifest.splash.width) || manifest.splash.width < 1 || manifest.splash.width > 288))) {\n fail(\"splash requires source, a six-digit hex backgroundColor, and width from 1 to 288\");\n }\n if (((_manifest_imagePicker = manifest.imagePicker) === null || _manifest_imagePicker === void 0 ? void 0 : _manifest_imagePicker.camera) !== void 0 && (typeof manifest.imagePicker.camera !== \"string\" || manifest.imagePicker.camera.trim() === \"\")) {\n fail(\"imagePicker.camera must be a non-empty string\");\n }\n if (manifest.photoLibrary !== void 0 && (!manifest.photoLibrary || typeof manifest.photoLibrary.addOnly !== \"string\" || manifest.photoLibrary.addOnly.trim() === \"\")) {\n fail(\"photoLibrary.addOnly must be a non-empty string\");\n }\n if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== \"string\" || manifest.contacts.usage.trim() === \"\")) {\n fail(\"contacts.usage must be a non-empty string\");\n }\n if (manifest.calendar !== void 0) {\n if (!manifest.calendar || manifest.calendar.usage === void 0 && manifest.calendar.remindersUsage === void 0) {\n fail(\"calendar.usage or calendar.remindersUsage must be a non-empty string\");\n }\n if (manifest.calendar.usage !== void 0 && (typeof manifest.calendar.usage !== \"string\" || manifest.calendar.usage.trim() === \"\")) {\n fail(\"calendar.usage must be a non-empty string\");\n }\n if (manifest.calendar.remindersUsage !== void 0 && (typeof manifest.calendar.remindersUsage !== \"string\" || manifest.calendar.remindersUsage.trim() === \"\")) {\n fail(\"calendar.remindersUsage must be a non-empty string\");\n }\n }\n if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== \"string\" || manifest.location.whenInUse.trim() === \"\")) {\n fail(\"location.whenInUse must be a non-empty string\");\n }\n if (manifest.audio !== void 0) {\n if (!manifest.audio || typeof manifest.audio !== \"object\") {\n fail(\"audio must configure microphone or background playback\");\n }\n if (manifest.audio.microphone !== void 0 && (typeof manifest.audio.microphone !== \"string\" || manifest.audio.microphone.trim() === \"\")) {\n fail(\"audio.microphone must be a non-empty string\");\n }\n if (manifest.audio.background !== void 0 && typeof manifest.audio.background !== \"boolean\") {\n fail(\"audio.background must be a boolean\");\n }\n if (manifest.audio.microphone === void 0 && manifest.audio.background !== true) {\n fail(\"audio must configure microphone or background playback\");\n }\n }\n if (((_manifest_ios = manifest.ios) === null || _manifest_ios === void 0 ? void 0 : _manifest_ios.faceIdUsageDescription) !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== \"string\" || manifest.ios.faceIdUsageDescription.trim() === \"\")) {\n fail(\"ios.faceIdUsageDescription must be a non-empty string\");\n }\n if (manifest.speech !== void 0 && (typeof ((_manifest_speech = manifest.speech) === null || _manifest_speech === void 0 ? void 0 : _manifest_speech.recognition) !== \"string\" || manifest.speech.recognition.trim() === \"\" || typeof manifest.speech.microphone !== \"string\" || manifest.speech.microphone.trim() === \"\")) {\n fail(\"speech.recognition and speech.microphone must be non-empty strings\");\n }\n if (manifest.notifications !== void 0) {\n if (typeof manifest.notifications !== \"object\" || manifest.notifications.push !== void 0 && typeof manifest.notifications.push !== \"boolean\") {\n fail(\"notifications.push must be a boolean\");\n }\n }\n if (manifest.pictureInPicture !== void 0 && typeof manifest.pictureInPicture !== \"boolean\") {\n fail(\"pictureInPicture must be a boolean\");\n }\n if (manifest.updates !== void 0) {\n if (typeof manifest.updates.runtimeVersion !== \"string\" || manifest.updates.runtimeVersion.trim() === \"\") {\n fail(\"updates.runtimeVersion must be a non-empty string\");\n }\n if (manifest.updates.url !== void 0 && (typeof manifest.updates.url !== \"string\" || manifest.updates.url.trim() === \"\")) {\n fail(\"updates.url must be a non-empty string\");\n }\n }\n if (!platform || platform === \"ios\") {\n var _manifest_ios1;\n if (!((_manifest_ios1 = manifest.ios) === null || _manifest_ios1 === void 0 ? void 0 : _manifest_ios1.bundleId) || !REVERSE_DNS.test(manifest.ios.bundleId)) {\n var _manifest_ios2;\n fail(`ios.bundleId \"${(_manifest_ios2 = manifest.ios) === null || _manifest_ios2 === void 0 ? void 0 : _manifest_ios2.bundleId}\" must be reverse-dns`);\n }\n if (manifest.ios.deploymentTarget !== void 0 && !DEPLOYMENT_TARGET.test(manifest.ios.deploymentTarget)) {\n fail(`ios.deploymentTarget \"${manifest.ios.deploymentTarget}\" must look like \"17.0\"`);\n }\n if (manifest.ios.buildNumber !== void 0 && !BUILD_NUMBER.test(manifest.ios.buildNumber)) {\n fail(`ios.buildNumber \"${manifest.ios.buildNumber}\" must contain only letters, digits, and dots`);\n }\n var widgets = manifest.ios.widgets;\n if (widgets) {\n var _widgets_displayName, _widgets_description;\n if (!manifest.ios.deploymentTarget || Number(manifest.ios.deploymentTarget) < 17) {\n fail(\"ios.widgets requires ios.deploymentTarget of 17.0 or newer\");\n }\n if (!/^group\\.[A-Za-z][A-Za-z0-9-]*(\\.[A-Za-z][A-Za-z0-9-]*)+$/.test(widgets.appGroup)) {\n fail(\"ios.widgets.appGroup must be a reverse-dns App Group beginning with group.\");\n }\n if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(widgets.kind)) {\n fail(\"ios.widgets.kind must be a non-empty WidgetKit kind\");\n }\n if (!((_widgets_displayName = widgets.displayName) === null || _widgets_displayName === void 0 ? void 0 : _widgets_displayName.trim()) || !((_widgets_description = widgets.description) === null || _widgets_description === void 0 ? void 0 : _widgets_description.trim())) {\n fail(\"ios.widgets.displayName and description must be non-empty strings\");\n }\n if (widgets.pushNotifications !== void 0 && typeof widgets.pushNotifications !== \"boolean\") {\n fail(\"ios.widgets.pushNotifications must be a boolean\");\n }\n }\n }\n if (!platform || platform === \"android\") {\n var _manifest_android;\n if (!((_manifest_android = manifest.android) === null || _manifest_android === void 0 ? void 0 : _manifest_android.applicationId) || !REVERSE_DNS.test(manifest.android.applicationId)) {\n var _manifest_android1;\n fail(`android.applicationId \"${(_manifest_android1 = manifest.android) === null || _manifest_android1 === void 0 ? void 0 : _manifest_android1.applicationId}\" must be reverse-dns`);\n }\n if (manifest.android.minSdk !== void 0 && (!Number.isInteger(manifest.android.minSdk) || manifest.android.minSdk < 21 || manifest.android.minSdk > 36)) {\n fail(`android.minSdk \"${manifest.android.minSdk}\" must be an integer from 21 to 36`);\n }\n if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {\n fail(`android.versionCode \"${manifest.android.versionCode}\" must be a positive integer`);\n }\n if (manifest.android.googleMapsApiKey !== void 0 && (typeof manifest.android.googleMapsApiKey !== \"string\" || manifest.android.googleMapsApiKey.trim() === \"\")) {\n fail(\"android.googleMapsApiKey must be a non-empty string\");\n }\n }\n return manifest;\n}\n//# sourceMappingURL=nativeAppManifest.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,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;EACrF;EACA,IAAI,SAAS,QAAQ,gBAAgB,KAAK,MAAM,CAAC,OAAO,UAAU,SAAS,QAAQ,WAAW,KAAK,SAAS,QAAQ,cAAc,IAAI;GACpI,KAAK,wBAAwB,SAAS,QAAQ,YAAY,6BAA6B;EACzF;EACA,IAAI,SAAS,QAAQ,qBAAqB,KAAK,MAAM,OAAO,SAAS,QAAQ,qBAAqB,YAAY,SAAS,QAAQ,iBAAiB,KAAK,MAAM,KAAK;GAC9J,KAAK,qDAAqD;EAC5D;CACF;CACA,OAAO;AACT"}
@@ -38,11 +38,33 @@ function validateNativeApp(manifest, platform) {
38
38
  if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== "string" || manifest.contacts.usage.trim() === "")) {
39
39
  fail("contacts.usage must be a non-empty string");
40
40
  }
41
+ if (manifest.calendar !== void 0) {
42
+ if (!manifest.calendar || manifest.calendar.usage === void 0 && manifest.calendar.remindersUsage === void 0) {
43
+ fail("calendar.usage or calendar.remindersUsage must be a non-empty string");
44
+ }
45
+ if (manifest.calendar.usage !== void 0 && (typeof manifest.calendar.usage !== "string" || manifest.calendar.usage.trim() === "")) {
46
+ fail("calendar.usage must be a non-empty string");
47
+ }
48
+ if (manifest.calendar.remindersUsage !== void 0 && (typeof manifest.calendar.remindersUsage !== "string" || manifest.calendar.remindersUsage.trim() === "")) {
49
+ fail("calendar.remindersUsage must be a non-empty string");
50
+ }
51
+ }
41
52
  if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== "string" || manifest.location.whenInUse.trim() === "")) {
42
53
  fail("location.whenInUse must be a non-empty string");
43
54
  }
44
- if (manifest.audio !== void 0 && (!manifest.audio || typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
45
- fail("audio.microphone must be a non-empty string");
55
+ if (manifest.audio !== void 0) {
56
+ if (!manifest.audio || typeof manifest.audio !== "object") {
57
+ fail("audio must configure microphone or background playback");
58
+ }
59
+ if (manifest.audio.microphone !== void 0 && (typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
60
+ fail("audio.microphone must be a non-empty string");
61
+ }
62
+ if (manifest.audio.background !== void 0 && typeof manifest.audio.background !== "boolean") {
63
+ fail("audio.background must be a boolean");
64
+ }
65
+ if (manifest.audio.microphone === void 0 && manifest.audio.background !== true) {
66
+ fail("audio must configure microphone or background playback");
67
+ }
46
68
  }
47
69
  if (manifest.ios?.faceIdUsageDescription !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== "string" || manifest.ios.faceIdUsageDescription.trim() === "")) {
48
70
  fail("ios.faceIdUsageDescription must be a non-empty string");
@@ -1 +1 @@
1
- {"version":3,"file":"nativeAppManifest.js","names":[],"sources":["esm/nativeAppManifest.js"],"sourcesContent":["const TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;\nconst SCHEME = /^[a-z][a-z0-9+.-]*$/i;\nconst VERSION = /^\\d+\\.\\d+\\.\\d+/;\nconst BUILD_NUMBER = /^[A-Za-z0-9.]+$/;\nconst REVERSE_DNS = /^[A-Za-z][A-Za-z0-9-]*(\\.[A-Za-z][A-Za-z0-9-]*)+$/;\nconst DEPLOYMENT_TARGET = /^\\d+\\.\\d+$/;\nconst HEX_COLOR = /^#[\\da-f]{6}$/i;\nfunction fail(message) {\n throw new Error(`[one] invalid native.app: ${message}`);\n}\nfunction validateNativeApp(manifest, platform) {\n if (!manifest || typeof manifest !== \"object\") fail(\"manifest must be an object\");\n if (!manifest.name || typeof manifest.name !== \"string\") fail(\"name is required\");\n if (!TARGET_NAME.test(manifest.name)) {\n fail(\n `name \"${manifest.name}\" must start with a letter and contain only letters, digits, and underscore`\n );\n }\n const schemes = manifest.scheme === void 0 ? [] : Array.isArray(manifest.scheme) ? manifest.scheme : [manifest.scheme];\n for (const scheme of schemes) {\n if (typeof scheme !== \"string\" || !SCHEME.test(scheme)) {\n fail(`scheme \"${scheme}\" must be a valid uri scheme`);\n }\n }\n if (manifest.version !== void 0 && !VERSION.test(manifest.version)) {\n fail(`version \"${manifest.version}\" must start with major.minor.patch`);\n }\n if (manifest.icon !== void 0 && (!manifest.icon.source || !HEX_COLOR.test(manifest.icon.backgroundColor))) {\n fail(\"icon requires source and a six-digit hex backgroundColor\");\n }\n if (manifest.splash !== void 0 && (!manifest.splash.source || !HEX_COLOR.test(manifest.splash.backgroundColor) || manifest.splash.width !== void 0 && (!Number.isFinite(manifest.splash.width) || manifest.splash.width < 1 || manifest.splash.width > 288))) {\n fail(\n \"splash requires source, a six-digit hex backgroundColor, and width from 1 to 288\"\n );\n }\n if (manifest.imagePicker?.camera !== void 0 && (typeof manifest.imagePicker.camera !== \"string\" || manifest.imagePicker.camera.trim() === \"\")) {\n fail(\"imagePicker.camera must be a non-empty string\");\n }\n if (manifest.photoLibrary !== void 0 && (!manifest.photoLibrary || typeof manifest.photoLibrary.addOnly !== \"string\" || manifest.photoLibrary.addOnly.trim() === \"\")) {\n fail(\"photoLibrary.addOnly must be a non-empty string\");\n }\n if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== \"string\" || manifest.contacts.usage.trim() === \"\")) {\n fail(\"contacts.usage must be a non-empty string\");\n }\n if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== \"string\" || manifest.location.whenInUse.trim() === \"\")) {\n fail(\"location.whenInUse must be a non-empty string\");\n }\n if (manifest.audio !== void 0 && (!manifest.audio || typeof manifest.audio.microphone !== \"string\" || manifest.audio.microphone.trim() === \"\")) {\n fail(\"audio.microphone must be a non-empty string\");\n }\n if (manifest.ios?.faceIdUsageDescription !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== \"string\" || manifest.ios.faceIdUsageDescription.trim() === \"\")) {\n fail(\"ios.faceIdUsageDescription must be a non-empty string\");\n }\n if (manifest.speech !== void 0 && (typeof manifest.speech?.recognition !== \"string\" || manifest.speech.recognition.trim() === \"\" || typeof manifest.speech.microphone !== \"string\" || manifest.speech.microphone.trim() === \"\")) {\n fail(\"speech.recognition and speech.microphone must be non-empty strings\");\n }\n if (manifest.notifications !== void 0) {\n if (typeof manifest.notifications !== \"object\" || manifest.notifications.push !== void 0 && typeof manifest.notifications.push !== \"boolean\") {\n fail(\"notifications.push must be a boolean\");\n }\n }\n if (manifest.pictureInPicture !== void 0 && typeof manifest.pictureInPicture !== \"boolean\") {\n fail(\"pictureInPicture must be a boolean\");\n }\n if (manifest.updates !== void 0) {\n if (typeof manifest.updates.runtimeVersion !== \"string\" || manifest.updates.runtimeVersion.trim() === \"\") {\n fail(\"updates.runtimeVersion must be a non-empty string\");\n }\n if (manifest.updates.url !== void 0 && (typeof manifest.updates.url !== \"string\" || manifest.updates.url.trim() === \"\")) {\n fail(\"updates.url must be a non-empty string\");\n }\n }\n if (!platform || platform === \"ios\") {\n if (!manifest.ios?.bundleId || !REVERSE_DNS.test(manifest.ios.bundleId)) {\n fail(`ios.bundleId \"${manifest.ios?.bundleId}\" must be reverse-dns`);\n }\n if (manifest.ios.deploymentTarget !== void 0 && !DEPLOYMENT_TARGET.test(manifest.ios.deploymentTarget)) {\n fail(\n `ios.deploymentTarget \"${manifest.ios.deploymentTarget}\" must look like \"17.0\"`\n );\n }\n if (manifest.ios.buildNumber !== void 0 && !BUILD_NUMBER.test(manifest.ios.buildNumber)) {\n fail(\n `ios.buildNumber \"${manifest.ios.buildNumber}\" must contain only letters, digits, and dots`\n );\n }\n const widgets = manifest.ios.widgets;\n if (widgets) {\n if (!manifest.ios.deploymentTarget || Number(manifest.ios.deploymentTarget) < 17) {\n fail(\"ios.widgets requires ios.deploymentTarget of 17.0 or newer\");\n }\n if (!/^group\\.[A-Za-z][A-Za-z0-9-]*(\\.[A-Za-z][A-Za-z0-9-]*)+$/.test(widgets.appGroup)) {\n fail(\"ios.widgets.appGroup must be a reverse-dns App Group beginning with group.\");\n }\n if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(widgets.kind)) {\n fail(\"ios.widgets.kind must be a non-empty WidgetKit kind\");\n }\n if (!widgets.displayName?.trim() || !widgets.description?.trim()) {\n fail(\"ios.widgets.displayName and description must be non-empty strings\");\n }\n if (widgets.pushNotifications !== void 0 && typeof widgets.pushNotifications !== \"boolean\") {\n fail(\"ios.widgets.pushNotifications must be a boolean\");\n }\n }\n }\n if (!platform || platform === \"android\") {\n if (!manifest.android?.applicationId || !REVERSE_DNS.test(manifest.android.applicationId)) {\n fail(\n `android.applicationId \"${manifest.android?.applicationId}\" must be reverse-dns`\n );\n }\n if (manifest.android.minSdk !== void 0 && (!Number.isInteger(manifest.android.minSdk) || manifest.android.minSdk < 21 || manifest.android.minSdk > 36)) {\n fail(`android.minSdk \"${manifest.android.minSdk}\" must be an integer from 21 to 36`);\n }\n if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {\n fail(\n `android.versionCode \"${manifest.android.versionCode}\" must be a positive integer`\n );\n }\n if (manifest.android.googleMapsApiKey !== void 0 && (typeof manifest.android.googleMapsApiKey !== \"string\" || manifest.android.googleMapsApiKey.trim() === \"\")) {\n fail(\"android.googleMapsApiKey must be a non-empty string\");\n }\n }\n return manifest;\n}\nexport {\n validateNativeApp\n};\n//# sourceMappingURL=nativeAppManifest.js.map\n"],"mappings":";AAAA,MAAM,cAAc;AACpB,MAAM,SAAS;AACf,MAAM,UAAU;AAChB,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,oBAAoB;AAC1B,MAAM,YAAY;AAClB,SAAS,KAAK,SAAS;CACrB,MAAM,IAAI,MAAM,6BAA6B,SAAS;AACxD;AACA,SAAS,kBAAkB,UAAU,UAAU;CAC7C,IAAI,CAAC,YAAY,OAAO,aAAa,UAAU,KAAK,4BAA4B;CAChF,IAAI,CAAC,SAAS,QAAQ,OAAO,SAAS,SAAS,UAAU,KAAK,kBAAkB;CAChF,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI,GAAG;EACpC,KACE,SAAS,SAAS,KAAK,4EACzB;CACF;CACA,MAAM,UAAU,SAAS,W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AM,CAAC,OAAO,UAAU,SAAS,QAAQ,WAAW,KAAK,SAAS,QAAQ,cAAc,IAAI;GACpI,KACE,wBAAwB,SAAS,QAAQ,YAAY,6BACvD;EACF;EACA,IAAI,SAAS,QAAQ,qBAAqB,KAAK,MAAM,OAAO,SAAS,QAAQ,qBAAqB,YAAY,SAAS,QAAQ,iBAAiB,KAAK,MAAM,KAAK;GAC9J,KAAK,qDAAqD;EAC5D;CACF;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"nativeAppManifest.js","names":[],"sources":["esm/nativeAppManifest.js"],"sourcesContent":["const TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;\nconst SCHEME = /^[a-z][a-z0-9+.-]*$/i;\nconst VERSION = /^\\d+\\.\\d+\\.\\d+/;\nconst BUILD_NUMBER = /^[A-Za-z0-9.]+$/;\nconst REVERSE_DNS = /^[A-Za-z][A-Za-z0-9-]*(\\.[A-Za-z][A-Za-z0-9-]*)+$/;\nconst DEPLOYMENT_TARGET = /^\\d+\\.\\d+$/;\nconst HEX_COLOR = /^#[\\da-f]{6}$/i;\nfunction fail(message) {\n throw new Error(`[one] invalid native.app: ${message}`);\n}\nfunction validateNativeApp(manifest, platform) {\n if (!manifest || typeof manifest !== \"object\") fail(\"manifest must be an object\");\n if (!manifest.name || typeof manifest.name !== \"string\") fail(\"name is required\");\n if (!TARGET_NAME.test(manifest.name)) {\n fail(\n `name \"${manifest.name}\" must start with a letter and contain only letters, digits, and underscore`\n );\n }\n const schemes = manifest.scheme === void 0 ? [] : Array.isArray(manifest.scheme) ? manifest.scheme : [manifest.scheme];\n for (const scheme of schemes) {\n if (typeof scheme !== \"string\" || !SCHEME.test(scheme)) {\n fail(`scheme \"${scheme}\" must be a valid uri scheme`);\n }\n }\n if (manifest.version !== void 0 && !VERSION.test(manifest.version)) {\n fail(`version \"${manifest.version}\" must start with major.minor.patch`);\n }\n if (manifest.icon !== void 0 && (!manifest.icon.source || !HEX_COLOR.test(manifest.icon.backgroundColor))) {\n fail(\"icon requires source and a six-digit hex backgroundColor\");\n }\n if (manifest.splash !== void 0 && (!manifest.splash.source || !HEX_COLOR.test(manifest.splash.backgroundColor) || manifest.splash.width !== void 0 && (!Number.isFinite(manifest.splash.width) || manifest.splash.width < 1 || manifest.splash.width > 288))) {\n fail(\n \"splash requires source, a six-digit hex backgroundColor, and width from 1 to 288\"\n );\n }\n if (manifest.imagePicker?.camera !== void 0 && (typeof manifest.imagePicker.camera !== \"string\" || manifest.imagePicker.camera.trim() === \"\")) {\n fail(\"imagePicker.camera must be a non-empty string\");\n }\n if (manifest.photoLibrary !== void 0 && (!manifest.photoLibrary || typeof manifest.photoLibrary.addOnly !== \"string\" || manifest.photoLibrary.addOnly.trim() === \"\")) {\n fail(\"photoLibrary.addOnly must be a non-empty string\");\n }\n if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== \"string\" || manifest.contacts.usage.trim() === \"\")) {\n fail(\"contacts.usage must be a non-empty string\");\n }\n if (manifest.calendar !== void 0) {\n if (!manifest.calendar || manifest.calendar.usage === void 0 && manifest.calendar.remindersUsage === void 0) {\n fail(\"calendar.usage or calendar.remindersUsage must be a non-empty string\");\n }\n if (manifest.calendar.usage !== void 0 && (typeof manifest.calendar.usage !== \"string\" || manifest.calendar.usage.trim() === \"\")) {\n fail(\"calendar.usage must be a non-empty string\");\n }\n if (manifest.calendar.remindersUsage !== void 0 && (typeof manifest.calendar.remindersUsage !== \"string\" || manifest.calendar.remindersUsage.trim() === \"\")) {\n fail(\"calendar.remindersUsage must be a non-empty string\");\n }\n }\n if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== \"string\" || manifest.location.whenInUse.trim() === \"\")) {\n fail(\"location.whenInUse must be a non-empty string\");\n }\n if (manifest.audio !== void 0) {\n if (!manifest.audio || typeof manifest.audio !== \"object\") {\n fail(\"audio must configure microphone or background playback\");\n }\n if (manifest.audio.microphone !== void 0 && (typeof manifest.audio.microphone !== \"string\" || manifest.audio.microphone.trim() === \"\")) {\n fail(\"audio.microphone must be a non-empty string\");\n }\n if (manifest.audio.background !== void 0 && typeof manifest.audio.background !== \"boolean\") {\n fail(\"audio.background must be a boolean\");\n }\n if (manifest.audio.microphone === void 0 && manifest.audio.background !== true) {\n fail(\"audio must configure microphone or background playback\");\n }\n }\n if (manifest.ios?.faceIdUsageDescription !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== \"string\" || manifest.ios.faceIdUsageDescription.trim() === \"\")) {\n fail(\"ios.faceIdUsageDescription must be a non-empty string\");\n }\n if (manifest.speech !== void 0 && (typeof manifest.speech?.recognition !== \"string\" || manifest.speech.recognition.trim() === \"\" || typeof manifest.speech.microphone !== \"string\" || manifest.speech.microphone.trim() === \"\")) {\n fail(\"speech.recognition and speech.microphone must be non-empty strings\");\n }\n if (manifest.notifications !== void 0) {\n if (typeof manifest.notifications !== \"object\" || manifest.notifications.push !== void 0 && typeof manifest.notifications.push !== \"boolean\") {\n fail(\"notifications.push must be a boolean\");\n }\n }\n if (manifest.pictureInPicture !== void 0 && typeof manifest.pictureInPicture !== \"boolean\") {\n fail(\"pictureInPicture must be a boolean\");\n }\n if (manifest.updates !== void 0) {\n if (typeof manifest.updates.runtimeVersion !== \"string\" || manifest.updates.runtimeVersion.trim() === \"\") {\n fail(\"updates.runtimeVersion must be a non-empty string\");\n }\n if (manifest.updates.url !== void 0 && (typeof manifest.updates.url !== \"string\" || manifest.updates.url.trim() === \"\")) {\n fail(\"updates.url must be a non-empty string\");\n }\n }\n if (!platform || platform === \"ios\") {\n if (!manifest.ios?.bundleId || !REVERSE_DNS.test(manifest.ios.bundleId)) {\n fail(`ios.bundleId \"${manifest.ios?.bundleId}\" must be reverse-dns`);\n }\n if (manifest.ios.deploymentTarget !== void 0 && !DEPLOYMENT_TARGET.test(manifest.ios.deploymentTarget)) {\n fail(\n `ios.deploymentTarget \"${manifest.ios.deploymentTarget}\" must look like \"17.0\"`\n );\n }\n if (manifest.ios.buildNumber !== void 0 && !BUILD_NUMBER.test(manifest.ios.buildNumber)) {\n fail(\n `ios.buildNumber \"${manifest.ios.buildNumber}\" must contain only letters, digits, and dots`\n );\n }\n const widgets = manifest.ios.widgets;\n if (widgets) {\n if (!manifest.ios.deploymentTarget || Number(manifest.ios.deploymentTarget) < 17) {\n fail(\"ios.widgets requires ios.deploymentTarget of 17.0 or newer\");\n }\n if (!/^group\\.[A-Za-z][A-Za-z0-9-]*(\\.[A-Za-z][A-Za-z0-9-]*)+$/.test(widgets.appGroup)) {\n fail(\"ios.widgets.appGroup must be a reverse-dns App Group beginning with group.\");\n }\n if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(widgets.kind)) {\n fail(\"ios.widgets.kind must be a non-empty WidgetKit kind\");\n }\n if (!widgets.displayName?.trim() || !widgets.description?.trim()) {\n fail(\"ios.widgets.displayName and description must be non-empty strings\");\n }\n if (widgets.pushNotifications !== void 0 && typeof widgets.pushNotifications !== \"boolean\") {\n fail(\"ios.widgets.pushNotifications must be a boolean\");\n }\n }\n }\n if (!platform || platform === \"android\") {\n if (!manifest.android?.applicationId || !REVERSE_DNS.test(manifest.android.applicationId)) {\n fail(\n `android.applicationId \"${manifest.android?.applicationId}\" must be reverse-dns`\n );\n }\n if (manifest.android.minSdk !== void 0 && (!Number.isInteger(manifest.android.minSdk) || manifest.android.minSdk < 21 || manifest.android.minSdk > 36)) {\n fail(`android.minSdk \"${manifest.android.minSdk}\" must be an integer from 21 to 36`);\n }\n if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {\n fail(\n `android.versionCode \"${manifest.android.versionCode}\" must be a positive integer`\n );\n }\n if (manifest.android.googleMapsApiKey !== void 0 && (typeof manifest.android.googleMapsApiKey !== \"string\" || manifest.android.googleMapsApiKey.trim() === \"\")) {\n fail(\"android.googleMapsApiKey must be a non-empty string\");\n }\n }\n return manifest;\n}\nexport {\n validateNativeApp\n};\n//# sourceMappingURL=nativeAppManifest.js.map\n"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UAAU,SAAS,QAAQ,WAAW,KAAK,SAAS,QAAQ,cAAc,IAAI;GACpI,KACE,wBAAwB,SAAS,QAAQ,YAAY,6BACvD;EACF;EACA,IAAI,SAAS,QAAQ,qBAAqB,KAAK,MAAM,OAAO,SAAS,QAAQ,qBAAqB,YAAY,SAAS,QAAQ,iBAAiB,KAAK,MAAM,KAAK;GAC9J,KAAK,qDAAqD;EAC5D;CACF;CACA,OAAO;AACT"}
@@ -56,11 +56,33 @@ function validateNativeApp(manifest, platform) {
56
56
  if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== "string" || manifest.contacts.usage.trim() === "")) {
57
57
  fail("contacts.usage must be a non-empty string");
58
58
  }
59
+ if (manifest.calendar !== void 0) {
60
+ if (!manifest.calendar || manifest.calendar.usage === void 0 && manifest.calendar.remindersUsage === void 0) {
61
+ fail("calendar.usage or calendar.remindersUsage must be a non-empty string");
62
+ }
63
+ if (manifest.calendar.usage !== void 0 && (typeof manifest.calendar.usage !== "string" || manifest.calendar.usage.trim() === "")) {
64
+ fail("calendar.usage must be a non-empty string");
65
+ }
66
+ if (manifest.calendar.remindersUsage !== void 0 && (typeof manifest.calendar.remindersUsage !== "string" || manifest.calendar.remindersUsage.trim() === "")) {
67
+ fail("calendar.remindersUsage must be a non-empty string");
68
+ }
69
+ }
59
70
  if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== "string" || manifest.location.whenInUse.trim() === "")) {
60
71
  fail("location.whenInUse must be a non-empty string");
61
72
  }
62
- if (manifest.audio !== void 0 && (!manifest.audio || typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
63
- fail("audio.microphone must be a non-empty string");
73
+ if (manifest.audio !== void 0) {
74
+ if (!manifest.audio || typeof manifest.audio !== "object") {
75
+ fail("audio must configure microphone or background playback");
76
+ }
77
+ if (manifest.audio.microphone !== void 0 && (typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
78
+ fail("audio.microphone must be a non-empty string");
79
+ }
80
+ if (manifest.audio.background !== void 0 && typeof manifest.audio.background !== "boolean") {
81
+ fail("audio.background must be a boolean");
82
+ }
83
+ if (manifest.audio.microphone === void 0 && manifest.audio.background !== true) {
84
+ fail("audio must configure microphone or background playback");
85
+ }
64
86
  }
65
87
  if (((_manifest_ios = manifest.ios) === null || _manifest_ios === void 0 ? void 0 : _manifest_ios.faceIdUsageDescription) !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== "string" || manifest.ios.faceIdUsageDescription.trim() === "")) {
66
88
  fail("ios.faceIdUsageDescription must be a non-empty string");
@@ -1 +1 @@
1
- {"version":3,"file":"nativeAppManifest.native.js","names":[],"sources":["esm/nativeAppManifest.native.js"],"sourcesContent":["var TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;\nvar SCHEME = /^[a-z][a-z0-9+.-]*$/i;\nvar VERSION = /^\\d+\\.\\d+\\.\\d+/;\nvar BUILD_NUMBER = /^[A-Za-z0-9.]+$/;\nvar REVERSE_DNS = /^[A-Za-z][A-Za-z0-9-]*(\\.[A-Za-z][A-Za-z0-9-]*)+$/;\nvar DEPLOYMENT_TARGET = /^\\d+\\.\\d+$/;\nvar HEX_COLOR = /^#[\\da-f]{6}$/i;\nfunction fail(message) {\n throw new Error(`[one] invalid native.app: ${message}`);\n}\nfunction validateNativeApp(manifest, platform) {\n var _manifest_imagePicker, _manifest_ios, _manifest_speech;\n if (!manifest || typeof manifest !== \"object\") fail(\"manifest must be an object\");\n if (!manifest.name || typeof manifest.name !== \"string\") fail(\"name is required\");\n if (!TARGET_NAME.test(manifest.name)) {\n fail(`name \"${manifest.name}\" must start with a letter and contain only letters, digits, and underscore`);\n }\n var schemes = manifest.scheme === void 0 ? [] : Array.isArray(manifest.scheme) ? manifest.scheme : [\n manifest.scheme\n ];\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = schemes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var scheme = _step.value;\n if (typeof scheme !== \"string\" || !SCHEME.test(scheme)) {\n fail(`scheme \"${scheme}\" must be a valid uri scheme`);\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (manifest.version !== void 0 && !VERSION.test(manifest.version)) {\n fail(`version \"${manifest.version}\" must start with major.minor.patch`);\n }\n if (manifest.icon !== void 0 && (!manifest.icon.source || !HEX_COLOR.test(manifest.icon.backgroundColor))) {\n fail(\"icon requires source and a six-digit hex backgroundColor\");\n }\n if (manifest.splash !== void 0 && (!manifest.splash.source || !HEX_COLOR.test(manifest.splash.backgroundColor) || manifest.splash.width !== void 0 && (!Number.isFinite(manifest.splash.width) || manifest.splash.width < 1 || manifest.splash.width > 288))) {\n fail(\"splash requires source, a six-digit hex backgroundColor, and width from 1 to 288\");\n }\n if (((_manifest_imagePicker = manifest.imagePicker) === null || _manifest_imagePicker === void 0 ? void 0 : _manifest_imagePicker.camera) !== void 0 && (typeof manifest.imagePicker.camera !== \"string\" || manifest.imagePicker.camera.trim() === \"\")) {\n fail(\"imagePicker.camera must be a non-empty string\");\n }\n if (manifest.photoLibrary !== void 0 && (!manifest.photoLibrary || typeof manifest.photoLibrary.addOnly !== \"string\" || manifest.photoLibrary.addOnly.trim() === \"\")) {\n fail(\"photoLibrary.addOnly must be a non-empty string\");\n }\n if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== \"string\" || manifest.contacts.usage.trim() === \"\")) {\n fail(\"contacts.usage must be a non-empty string\");\n }\n if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== \"string\" || manifest.location.whenInUse.trim() === \"\")) {\n fail(\"location.whenInUse must be a non-empty string\");\n }\n if (manifest.audio !== void 0 && (!manifest.audio || typeof manifest.audio.microphone !== \"string\" || manifest.audio.microphone.trim() === \"\")) {\n fail(\"audio.microphone must be a non-empty string\");\n }\n if (((_manifest_ios = manifest.ios) === null || _manifest_ios === void 0 ? void 0 : _manifest_ios.faceIdUsageDescription) !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== \"string\" || manifest.ios.faceIdUsageDescription.trim() === \"\")) {\n fail(\"ios.faceIdUsageDescription must be a non-empty string\");\n }\n if (manifest.speech !== void 0 && (typeof ((_manifest_speech = manifest.speech) === null || _manifest_speech === void 0 ? void 0 : _manifest_speech.recognition) !== \"string\" || manifest.speech.recognition.trim() === \"\" || typeof manifest.speech.microphone !== \"string\" || manifest.speech.microphone.trim() === \"\")) {\n fail(\"speech.recognition and speech.microphone must be non-empty strings\");\n }\n if (manifest.notifications !== void 0) {\n if (typeof manifest.notifications !== \"object\" || manifest.notifications.push !== void 0 && typeof manifest.notifications.push !== \"boolean\") {\n fail(\"notifications.push must be a boolean\");\n }\n }\n if (manifest.pictureInPicture !== void 0 && typeof manifest.pictureInPicture !== \"boolean\") {\n fail(\"pictureInPicture must be a boolean\");\n }\n if (manifest.updates !== void 0) {\n if (typeof manifest.updates.runtimeVersion !== \"string\" || manifest.updates.runtimeVersion.trim() === \"\") {\n fail(\"updates.runtimeVersion must be a non-empty string\");\n }\n if (manifest.updates.url !== void 0 && (typeof manifest.updates.url !== \"string\" || manifest.updates.url.trim() === \"\")) {\n fail(\"updates.url must be a non-empty string\");\n }\n }\n if (!platform || platform === \"ios\") {\n var _manifest_ios1;\n if (!((_manifest_ios1 = manifest.ios) === null || _manifest_ios1 === void 0 ? void 0 : _manifest_ios1.bundleId) || !REVERSE_DNS.test(manifest.ios.bundleId)) {\n var _manifest_ios2;\n fail(`ios.bundleId \"${(_manifest_ios2 = manifest.ios) === null || _manifest_ios2 === void 0 ? void 0 : _manifest_ios2.bundleId}\" must be reverse-dns`);\n }\n if (manifest.ios.deploymentTarget !== void 0 && !DEPLOYMENT_TARGET.test(manifest.ios.deploymentTarget)) {\n fail(`ios.deploymentTarget \"${manifest.ios.deploymentTarget}\" must look like \"17.0\"`);\n }\n if (manifest.ios.buildNumber !== void 0 && !BUILD_NUMBER.test(manifest.ios.buildNumber)) {\n fail(`ios.buildNumber \"${manifest.ios.buildNumber}\" must contain only letters, digits, and dots`);\n }\n var widgets = manifest.ios.widgets;\n if (widgets) {\n var _widgets_displayName, _widgets_description;\n if (!manifest.ios.deploymentTarget || Number(manifest.ios.deploymentTarget) < 17) {\n fail(\"ios.widgets requires ios.deploymentTarget of 17.0 or newer\");\n }\n if (!/^group\\.[A-Za-z][A-Za-z0-9-]*(\\.[A-Za-z][A-Za-z0-9-]*)+$/.test(widgets.appGroup)) {\n fail(\"ios.widgets.appGroup must be a reverse-dns App Group beginning with group.\");\n }\n if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(widgets.kind)) {\n fail(\"ios.widgets.kind must be a non-empty WidgetKit kind\");\n }\n if (!((_widgets_displayName = widgets.displayName) === null || _widgets_displayName === void 0 ? void 0 : _widgets_displayName.trim()) || !((_widgets_description = widgets.description) === null || _widgets_description === void 0 ? void 0 : _widgets_description.trim())) {\n fail(\"ios.widgets.displayName and description must be non-empty strings\");\n }\n if (widgets.pushNotifications !== void 0 && typeof widgets.pushNotifications !== \"boolean\") {\n fail(\"ios.widgets.pushNotifications must be a boolean\");\n }\n }\n }\n if (!platform || platform === \"android\") {\n var _manifest_android;\n if (!((_manifest_android = manifest.android) === null || _manifest_android === void 0 ? void 0 : _manifest_android.applicationId) || !REVERSE_DNS.test(manifest.android.applicationId)) {\n var _manifest_android1;\n fail(`android.applicationId \"${(_manifest_android1 = manifest.android) === null || _manifest_android1 === void 0 ? void 0 : _manifest_android1.applicationId}\" must be reverse-dns`);\n }\n if (manifest.android.minSdk !== void 0 && (!Number.isInteger(manifest.android.minSdk) || manifest.android.minSdk < 21 || manifest.android.minSdk > 36)) {\n fail(`android.minSdk \"${manifest.android.minSdk}\" must be an integer from 21 to 36`);\n }\n if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {\n fail(`android.versionCode \"${manifest.android.versionCode}\" must be a positive integer`);\n }\n if (manifest.android.googleMapsApiKey !== void 0 && (typeof manifest.android.googleMapsApiKey !== \"string\" || manifest.android.googleMapsApiKey.trim() === \"\")) {\n fail(\"android.googleMapsApiKey must be a non-empty string\");\n }\n }\n return manifest;\n}\nexport {\n validateNativeApp\n};\n//# sourceMappingURL=nativeAppManifest.js.map\n"],"mappings":";AAAA,IAAI,cAAc;AAClB,IAAI,SAAS;AACb,IAAI,UAAU;AACd,IAAI,eAAe;AACnB,IAAI,cAAc;AAClB,IAAI,oBAAoB;AACxB,IAAI,YAAY;AAChB,SAAS,KAAK,SAAS;CACrB,MAAM,IAAI,MAAM,6BAA6B,SAAS;AACxD;AACA,SAAS,kBAAkB,UAAU,UAAU;CAC7C,IAAI,uBAAuB,eAAe;CAC1C,IAAI,CAAC,YAAY,OAAO,aAAa,UAAU,KAAK,4BAA4B;CAChF,IAAI,CAAC,SAAS,QAAQ,OAAO,SAAS,SAAS,UAAU,KAAK,kBAAkB;CAChF,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI,GAAG;EACpC,KAAK,SAAS,SAAS,KAAK,4EAA4E;CAC1G;CACA,IAAI,UAAU,SAAS,WAAW,KAAK,IAAI,CAAC,IAAI,MAAM,QAAQ,SAAS,MAAM,IAAI,SAAS,SAAS,CACjG,SAAS,MACX;CACA,IAAI,4BAA4B,MAAM,oBAAoB,OAAO,iBAAiB,KAAK;CACvF,IAAI;EACF,KAAK,IAAI,YAAY,QAAQ,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,6BAA6B,QAAQ,UAAU,KAAK,EAAC,CAAE,OAAO,4BAA4B,MAAM;GACxJ,IAAI,SAAS,MAAM;GACnB,IAAI,OAAO,WAAW,YAAY,CAAC,OAAO,KAAK,MAAM,GAAG;IACtD,KAAK,WAAW,OAAO,6BAA6B;GACtD;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AK,iDAAiD;GACxD;EACF;CACF;CACA,IAAI,CAAC,YAAY,aAAa,WAAW;EACvC,IAAI;EACJ,IAAI,GAAG,oBAAoB,SAAS,aAAa,QAAQ,sBAAsB,KAAK,IAAI,KAAK,IAAI,kBAAkB,kBAAkB,CAAC,YAAY,KAAK,SAAS,QAAQ,aAAa,GAAG;GACtL,IAAI;GACJ,KAAK,2BAA2B,qBAAqB,SAAS,aAAa,QAAQ,uBAAuB,KAAK,IAAI,KAAK,IAAI,mBAAmB,cAAc,sBAAsB;EACrL;EACA,IAAI,SAAS,QAAQ,WAAW,KAAK,MAAM,CAAC,OAAO,UAAU,SAAS,QAAQ,MAAM,KAAK,SAAS,QAAQ,SAAS,MAAM,SAAS,QAAQ,SAAS,KAAK;GACtJ,KAAK,mBAAmB,SAAS,QAAQ,OAAO,mCAAmC;EACrF;EACA,IAAI,SAAS,QAAQ,gBAAgB,KAAK,MAAM,CAAC,OAAO,UAAU,SAAS,QAAQ,WAAW,KAAK,SAAS,QAAQ,cAAc,IAAI;GACpI,KAAK,wBAAwB,SAAS,QAAQ,YAAY,6BAA6B;EACzF;EACA,IAAI,SAAS,QAAQ,qBAAqB,KAAK,MAAM,OAAO,SAAS,QAAQ,qBAAqB,YAAY,SAAS,QAAQ,iBAAiB,KAAK,MAAM,KAAK;GAC9J,KAAK,qDAAqD;EAC5D;CACF;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"nativeAppManifest.native.js","names":[],"sources":["esm/nativeAppManifest.native.js"],"sourcesContent":["var TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;\nvar SCHEME = /^[a-z][a-z0-9+.-]*$/i;\nvar VERSION = /^\\d+\\.\\d+\\.\\d+/;\nvar BUILD_NUMBER = /^[A-Za-z0-9.]+$/;\nvar REVERSE_DNS = /^[A-Za-z][A-Za-z0-9-]*(\\.[A-Za-z][A-Za-z0-9-]*)+$/;\nvar DEPLOYMENT_TARGET = /^\\d+\\.\\d+$/;\nvar HEX_COLOR = /^#[\\da-f]{6}$/i;\nfunction fail(message) {\n throw new Error(`[one] invalid native.app: ${message}`);\n}\nfunction validateNativeApp(manifest, platform) {\n var _manifest_imagePicker, _manifest_ios, _manifest_speech;\n if (!manifest || typeof manifest !== \"object\") fail(\"manifest must be an object\");\n if (!manifest.name || typeof manifest.name !== \"string\") fail(\"name is required\");\n if (!TARGET_NAME.test(manifest.name)) {\n fail(`name \"${manifest.name}\" must start with a letter and contain only letters, digits, and underscore`);\n }\n var schemes = manifest.scheme === void 0 ? [] : Array.isArray(manifest.scheme) ? manifest.scheme : [\n manifest.scheme\n ];\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = schemes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var scheme = _step.value;\n if (typeof scheme !== \"string\" || !SCHEME.test(scheme)) {\n fail(`scheme \"${scheme}\" must be a valid uri scheme`);\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n if (manifest.version !== void 0 && !VERSION.test(manifest.version)) {\n fail(`version \"${manifest.version}\" must start with major.minor.patch`);\n }\n if (manifest.icon !== void 0 && (!manifest.icon.source || !HEX_COLOR.test(manifest.icon.backgroundColor))) {\n fail(\"icon requires source and a six-digit hex backgroundColor\");\n }\n if (manifest.splash !== void 0 && (!manifest.splash.source || !HEX_COLOR.test(manifest.splash.backgroundColor) || manifest.splash.width !== void 0 && (!Number.isFinite(manifest.splash.width) || manifest.splash.width < 1 || manifest.splash.width > 288))) {\n fail(\"splash requires source, a six-digit hex backgroundColor, and width from 1 to 288\");\n }\n if (((_manifest_imagePicker = manifest.imagePicker) === null || _manifest_imagePicker === void 0 ? void 0 : _manifest_imagePicker.camera) !== void 0 && (typeof manifest.imagePicker.camera !== \"string\" || manifest.imagePicker.camera.trim() === \"\")) {\n fail(\"imagePicker.camera must be a non-empty string\");\n }\n if (manifest.photoLibrary !== void 0 && (!manifest.photoLibrary || typeof manifest.photoLibrary.addOnly !== \"string\" || manifest.photoLibrary.addOnly.trim() === \"\")) {\n fail(\"photoLibrary.addOnly must be a non-empty string\");\n }\n if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== \"string\" || manifest.contacts.usage.trim() === \"\")) {\n fail(\"contacts.usage must be a non-empty string\");\n }\n if (manifest.calendar !== void 0) {\n if (!manifest.calendar || manifest.calendar.usage === void 0 && manifest.calendar.remindersUsage === void 0) {\n fail(\"calendar.usage or calendar.remindersUsage must be a non-empty string\");\n }\n if (manifest.calendar.usage !== void 0 && (typeof manifest.calendar.usage !== \"string\" || manifest.calendar.usage.trim() === \"\")) {\n fail(\"calendar.usage must be a non-empty string\");\n }\n if (manifest.calendar.remindersUsage !== void 0 && (typeof manifest.calendar.remindersUsage !== \"string\" || manifest.calendar.remindersUsage.trim() === \"\")) {\n fail(\"calendar.remindersUsage must be a non-empty string\");\n }\n }\n if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== \"string\" || manifest.location.whenInUse.trim() === \"\")) {\n fail(\"location.whenInUse must be a non-empty string\");\n }\n if (manifest.audio !== void 0) {\n if (!manifest.audio || typeof manifest.audio !== \"object\") {\n fail(\"audio must configure microphone or background playback\");\n }\n if (manifest.audio.microphone !== void 0 && (typeof manifest.audio.microphone !== \"string\" || manifest.audio.microphone.trim() === \"\")) {\n fail(\"audio.microphone must be a non-empty string\");\n }\n if (manifest.audio.background !== void 0 && typeof manifest.audio.background !== \"boolean\") {\n fail(\"audio.background must be a boolean\");\n }\n if (manifest.audio.microphone === void 0 && manifest.audio.background !== true) {\n fail(\"audio must configure microphone or background playback\");\n }\n }\n if (((_manifest_ios = manifest.ios) === null || _manifest_ios === void 0 ? void 0 : _manifest_ios.faceIdUsageDescription) !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== \"string\" || manifest.ios.faceIdUsageDescription.trim() === \"\")) {\n fail(\"ios.faceIdUsageDescription must be a non-empty string\");\n }\n if (manifest.speech !== void 0 && (typeof ((_manifest_speech = manifest.speech) === null || _manifest_speech === void 0 ? void 0 : _manifest_speech.recognition) !== \"string\" || manifest.speech.recognition.trim() === \"\" || typeof manifest.speech.microphone !== \"string\" || manifest.speech.microphone.trim() === \"\")) {\n fail(\"speech.recognition and speech.microphone must be non-empty strings\");\n }\n if (manifest.notifications !== void 0) {\n if (typeof manifest.notifications !== \"object\" || manifest.notifications.push !== void 0 && typeof manifest.notifications.push !== \"boolean\") {\n fail(\"notifications.push must be a boolean\");\n }\n }\n if (manifest.pictureInPicture !== void 0 && typeof manifest.pictureInPicture !== \"boolean\") {\n fail(\"pictureInPicture must be a boolean\");\n }\n if (manifest.updates !== void 0) {\n if (typeof manifest.updates.runtimeVersion !== \"string\" || manifest.updates.runtimeVersion.trim() === \"\") {\n fail(\"updates.runtimeVersion must be a non-empty string\");\n }\n if (manifest.updates.url !== void 0 && (typeof manifest.updates.url !== \"string\" || manifest.updates.url.trim() === \"\")) {\n fail(\"updates.url must be a non-empty string\");\n }\n }\n if (!platform || platform === \"ios\") {\n var _manifest_ios1;\n if (!((_manifest_ios1 = manifest.ios) === null || _manifest_ios1 === void 0 ? void 0 : _manifest_ios1.bundleId) || !REVERSE_DNS.test(manifest.ios.bundleId)) {\n var _manifest_ios2;\n fail(`ios.bundleId \"${(_manifest_ios2 = manifest.ios) === null || _manifest_ios2 === void 0 ? void 0 : _manifest_ios2.bundleId}\" must be reverse-dns`);\n }\n if (manifest.ios.deploymentTarget !== void 0 && !DEPLOYMENT_TARGET.test(manifest.ios.deploymentTarget)) {\n fail(`ios.deploymentTarget \"${manifest.ios.deploymentTarget}\" must look like \"17.0\"`);\n }\n if (manifest.ios.buildNumber !== void 0 && !BUILD_NUMBER.test(manifest.ios.buildNumber)) {\n fail(`ios.buildNumber \"${manifest.ios.buildNumber}\" must contain only letters, digits, and dots`);\n }\n var widgets = manifest.ios.widgets;\n if (widgets) {\n var _widgets_displayName, _widgets_description;\n if (!manifest.ios.deploymentTarget || Number(manifest.ios.deploymentTarget) < 17) {\n fail(\"ios.widgets requires ios.deploymentTarget of 17.0 or newer\");\n }\n if (!/^group\\.[A-Za-z][A-Za-z0-9-]*(\\.[A-Za-z][A-Za-z0-9-]*)+$/.test(widgets.appGroup)) {\n fail(\"ios.widgets.appGroup must be a reverse-dns App Group beginning with group.\");\n }\n if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(widgets.kind)) {\n fail(\"ios.widgets.kind must be a non-empty WidgetKit kind\");\n }\n if (!((_widgets_displayName = widgets.displayName) === null || _widgets_displayName === void 0 ? void 0 : _widgets_displayName.trim()) || !((_widgets_description = widgets.description) === null || _widgets_description === void 0 ? void 0 : _widgets_description.trim())) {\n fail(\"ios.widgets.displayName and description must be non-empty strings\");\n }\n if (widgets.pushNotifications !== void 0 && typeof widgets.pushNotifications !== \"boolean\") {\n fail(\"ios.widgets.pushNotifications must be a boolean\");\n }\n }\n }\n if (!platform || platform === \"android\") {\n var _manifest_android;\n if (!((_manifest_android = manifest.android) === null || _manifest_android === void 0 ? void 0 : _manifest_android.applicationId) || !REVERSE_DNS.test(manifest.android.applicationId)) {\n var _manifest_android1;\n fail(`android.applicationId \"${(_manifest_android1 = manifest.android) === null || _manifest_android1 === void 0 ? void 0 : _manifest_android1.applicationId}\" must be reverse-dns`);\n }\n if (manifest.android.minSdk !== void 0 && (!Number.isInteger(manifest.android.minSdk) || manifest.android.minSdk < 21 || manifest.android.minSdk > 36)) {\n fail(`android.minSdk \"${manifest.android.minSdk}\" must be an integer from 21 to 36`);\n }\n if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {\n fail(`android.versionCode \"${manifest.android.versionCode}\" must be a positive integer`);\n }\n if (manifest.android.googleMapsApiKey !== void 0 && (typeof manifest.android.googleMapsApiKey !== \"string\" || manifest.android.googleMapsApiKey.trim() === \"\")) {\n fail(\"android.googleMapsApiKey must be a non-empty string\");\n }\n }\n return manifest;\n}\nexport {\n validateNativeApp\n};\n//# sourceMappingURL=nativeAppManifest.js.map\n"],"mappings":";AAAA,IAAI,cAAc;AAClB,IAAI,SAAS;AACb,IAAI,UAAU;AACd,IAAI,eAAe;AACnB,IAAI,cAAc;AAClB,IAAI,oBAAoB;AACxB,IAAI,YAAY;AAChB,SAAS,KAAK,SAAS;CACrB,MAAM,IAAI,MAAM,6BAA6B,SAAS;AACxD;AACA,SAAS,kBAAkB,UAAU,UAAU;CAC7C,IAAI,uBAAuB,eAAe;CAC1C,IAAI,CAAC,YAAY,OAAO,aAAa,UAAU,KAAK,4BAA4B;CAChF,IAAI,CAAC,SAAS,QAAQ,OAAO,SAAS,SAAS,UAAU,KAAK,kBAAkB;CAChF,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI,GAAG;EACpC,KAAK,SAAS,SAAS,KAAK,4EAA4E;CAC1G;CACA,IAAI,UAAU,SAAS,WAAW,KAAK,IAAI,CAAC,IAAI,MAAM,QAAQ,SAAS,MAAM,IAAI,SAAS,SAAS,CACjG,SAAS,MACX;CACA,IAAI,4BAA4B,MAAM,oBAAoB,OAAO,iBAAiB,KAAK;CACvF,IAAI;EACF,KAAK,IAAI,YAAY,QAAQ,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,6BAA6B,QAAQ,UAAU,KAAK,EAAC,CAAE,OAAO,4BAA4B,MAAM;GACxJ,IAAI,SAAS,MAAM;GACnB,IAAI,OAAO,WAAW,YAAY,CAAC,OAAO,KAAK,MAAM,GAAG;IACtD,KAAK,WAAW,OAAO,6BAA6B;GACtD;EACF;CACF,SAAS,KAAK;EACZ,oBAAoB;EACpB,iBAAiB;CACnB,UAAU;EACR,IAAI;GACF,IAAI,CAAC,6BAA6B,UAAU,UAAU,MAAM;IAC1D,UAAU,OAAO;GACnB;EACF,UAAU;GACR,IAAI,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B,SAAS,QAAQ,YAAY,6BAA6B;EACzF;EACA,IAAI,SAAS,QAAQ,qBAAqB,KAAK,MAAM,OAAO,SAAS,QAAQ,qBAAqB,YAAY,SAAS,QAAQ,iBAAiB,KAAK,MAAM,KAAK;GAC9J,KAAK,qDAAqD;EAC5D;CACF;CACA,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vxrn/utils",
3
- "version": "2.0.0-beta.123.1",
3
+ "version": "2.0.0-beta.128.1",
4
4
  "sideEffects": false,
5
5
  "type": "module",
6
6
  "types": "./types/index.d.ts",
@@ -41,8 +41,8 @@
41
41
  "typecheck": "tsc --noEmit"
42
42
  },
43
43
  "dependencies": {
44
- "@vxrn/debug": "2.0.0-beta.123.1",
45
- "@vxrn/resolve": "2.0.0-beta.123.1",
44
+ "@vxrn/debug": "2.0.0-beta.128.1",
45
+ "@vxrn/resolve": "2.0.0-beta.128.1",
46
46
  "ws": "^8.21.0"
47
47
  },
48
48
  "devDependencies": {
@@ -72,6 +72,11 @@ describe('native.app manifest', () => {
72
72
 
73
73
  test('requires an audio recording prompt', () => {
74
74
  expect(() => validateNativeApp({ ...app, audio: { microphone: 'Record notes.' } })).not.toThrow()
75
+ expect(() => validateNativeApp({ ...app, audio: { background: true } })).not.toThrow()
76
+ expect(() => validateNativeApp({ ...app, audio: {} })).toThrow(/audio must configure/)
77
+ expect(() => validateNativeApp({ ...app, audio: { background: 'yes' } as any })).toThrow(
78
+ /audio\.background/
79
+ )
75
80
  expect(() => validateNativeApp({ ...app, audio: { microphone: ' ' } })).toThrow(
76
81
  /audio\.microphone/
77
82
  )
@@ -95,6 +100,17 @@ describe('native.app manifest', () => {
95
100
  )
96
101
  })
97
102
 
103
+ test('requires a Calendar purpose string', () => {
104
+ expect(() => validateNativeApp({ ...app, calendar: { usage: 'Show events.' } })).not.toThrow()
105
+ expect(() => validateNativeApp({ ...app, calendar: { remindersUsage: 'Manage tasks.' } })).not.toThrow()
106
+ expect(() => validateNativeApp({ ...app, calendar: {} })).toThrow(/calendar\.usage/)
107
+ expect(() => validateNativeApp({ ...app, calendar: null } as any)).toThrow(/calendar\.usage/)
108
+ expect(() => validateNativeApp({ ...app, calendar: { usage: ' ' } })).toThrow(/calendar\.usage/)
109
+ expect(() => validateNativeApp({ ...app, calendar: { remindersUsage: ' ' } })).toThrow(
110
+ /calendar\.remindersUsage/
111
+ )
112
+ })
113
+
98
114
  test('accepts a camera permission string and rejects empty ones', () => {
99
115
  expect(() => validateNativeApp({ ...app, imagePicker: undefined })).not.toThrow()
100
116
  expect(() => validateNativeApp({ ...app, imagePicker: { camera: '' } })).toThrow(
@@ -30,13 +30,19 @@ export interface NativeAppManifest {
30
30
  contacts?: {
31
31
  usage: string
32
32
  }
33
+ // full EventKit access for calendar events and reminders.
34
+ calendar?: {
35
+ usage?: string
36
+ remindersUsage?: string
37
+ }
33
38
  // foreground Core Location permission prompt for One.iOS.Location.
34
39
  location?: {
35
40
  whenInUse: string
36
41
  }
37
- // microphone prompt for One.iOS.Audio recording. playback needs no prompt.
42
+ // microphone prompt and background playback for One.iOS.Audio.
38
43
  audio?: {
39
- microphone: string
44
+ microphone?: string
45
+ background?: boolean
40
46
  }
41
47
  // usage descriptions for One.Speech dictation, shown at the ios speech
42
48
  // recognition and microphone prompts. setting them also declares the
@@ -181,6 +187,21 @@ export function validateNativeApp(
181
187
  ) {
182
188
  fail('contacts.usage must be a non-empty string')
183
189
  }
190
+ if (manifest.calendar !== undefined) {
191
+ if (!manifest.calendar ||
192
+ (manifest.calendar.usage === undefined && manifest.calendar.remindersUsage === undefined)) {
193
+ fail('calendar.usage or calendar.remindersUsage must be a non-empty string')
194
+ }
195
+ if (manifest.calendar.usage !== undefined &&
196
+ (typeof manifest.calendar.usage !== 'string' || manifest.calendar.usage.trim() === '')) {
197
+ fail('calendar.usage must be a non-empty string')
198
+ }
199
+ if (manifest.calendar.remindersUsage !== undefined &&
200
+ (typeof manifest.calendar.remindersUsage !== 'string' ||
201
+ manifest.calendar.remindersUsage.trim() === '')) {
202
+ fail('calendar.remindersUsage must be a non-empty string')
203
+ }
204
+ }
184
205
  if (
185
206
  manifest.location !== undefined &&
186
207
  (!manifest.location ||
@@ -189,13 +210,25 @@ export function validateNativeApp(
189
210
  ) {
190
211
  fail('location.whenInUse must be a non-empty string')
191
212
  }
192
- if (
193
- manifest.audio !== undefined &&
194
- (!manifest.audio ||
195
- typeof manifest.audio.microphone !== 'string' ||
196
- manifest.audio.microphone.trim() === '')
197
- ) {
198
- fail('audio.microphone must be a non-empty string')
213
+ if (manifest.audio !== undefined) {
214
+ if (!manifest.audio || typeof manifest.audio !== 'object') {
215
+ fail('audio must configure microphone or background playback')
216
+ }
217
+ if (
218
+ manifest.audio.microphone !== undefined &&
219
+ (typeof manifest.audio.microphone !== 'string' || manifest.audio.microphone.trim() === '')
220
+ ) {
221
+ fail('audio.microphone must be a non-empty string')
222
+ }
223
+ if (
224
+ manifest.audio.background !== undefined &&
225
+ typeof manifest.audio.background !== 'boolean'
226
+ ) {
227
+ fail('audio.background must be a boolean')
228
+ }
229
+ if (manifest.audio.microphone === undefined && manifest.audio.background !== true) {
230
+ fail('audio must configure microphone or background playback')
231
+ }
199
232
  }
200
233
  if (
201
234
  manifest.ios?.faceIdUsageDescription !== undefined &&
@@ -21,11 +21,16 @@ export interface NativeAppManifest {
21
21
  contacts?: {
22
22
  usage: string;
23
23
  };
24
+ calendar?: {
25
+ usage?: string;
26
+ remindersUsage?: string;
27
+ };
24
28
  location?: {
25
29
  whenInUse: string;
26
30
  };
27
31
  audio?: {
28
- microphone: string;
32
+ microphone?: string;
33
+ background?: boolean;
29
34
  };
30
35
  speech?: {
31
36
  recognition: string;
@@ -1 +1 @@
1
- {"version":3,"file":"nativeAppManifest.d.ts","sourceRoot":"","sources":["../src/nativeAppManifest.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAA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