@apps-in-toss/framework 0.0.0-dev.1741675190621 → 0.0.0-dev.1741859884482

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
@@ -216,6 +216,14 @@ async function fetchAlbumPhotos(options) {
216
216
  maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
217
217
  maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
218
218
  });
219
+ if (options.base64) {
220
+ return albumPhotos.map((photo) => {
221
+ return {
222
+ ...photo,
223
+ dataUri: `data:image/jpeg;base64,${photo.dataUri}`
224
+ };
225
+ });
226
+ }
219
227
  return albumPhotos;
220
228
  }
221
229
 
@@ -250,14 +258,21 @@ var import_react = require("react");
250
258
  var import_react_native_bedrock4 = require("react-native-bedrock");
251
259
  var bridges = __toESM(require("react-native-bedrock/bridges"), 1);
252
260
  var constantBridges = __toESM(require("react-native-bedrock/constants"), 1);
261
+
262
+ // src/env.ts
263
+ var env = {
264
+ getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
265
+ };
266
+
267
+ // src/components/WebView.tsx
253
268
  var import_jsx_runtime2 = require("react/jsx-runtime");
254
- function WebView({ localhostPort = 5173, onMessage, ...props }) {
269
+ function WebView({ local, onMessage, ...props }) {
255
270
  const uri = (0, import_react.useMemo)(() => {
256
271
  if (__DEV__) {
257
- return `http://localhost:${localhostPort}`;
272
+ return `http://${local.host}:${local.port}`;
258
273
  }
259
- return AppsInTossModule.getWebBundleURL({}).url;
260
- }, [localhostPort]);
274
+ return `https://${import_react_native_bedrock4.Bedrock.appName}.alpha-apps.tossmini.com`;
275
+ }, [local]);
261
276
  const handler = (0, import_react_native_bedrock4.useBridgeHandler)({
262
277
  onMessage,
263
278
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -277,9 +292,15 @@ function WebView({ localhostPort = 5173, onMessage, ...props }) {
277
292
  {
278
293
  ref: handler.ref,
279
294
  ...props,
280
- source: { uri },
295
+ source: {
296
+ uri,
297
+ headers: {
298
+ "x-mini-deployment-id": env.getDeploymentId()
299
+ }
300
+ },
281
301
  sharedCookiesEnabled: true,
282
302
  thirdPartyCookiesEnabled: true,
303
+ cacheEnabled: false,
283
304
  onMessage: handler.onMessage,
284
305
  injectedJavaScript: handler.injectedJavaScript,
285
306
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
@@ -310,11 +331,6 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
310
331
  return location;
311
332
  }
312
333
 
313
- // src/env.ts
314
- var env = {
315
- getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
316
- };
317
-
318
334
  // src/types.ts
319
335
  var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
320
336
  Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
package/dist/index.d.cts CHANGED
@@ -172,7 +172,7 @@ interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation'
172
172
  * useEffect(() => {
173
173
  * return startUpdateLocation({
174
174
  * options: {
175
- * accuracy: Accuracy.Default,
175
+ * accuracy: Accuracy.Balanced,
176
176
  * timeInterval: 3000,
177
177
  * distanceInterval: 10,
178
178
  * },
@@ -589,10 +589,13 @@ declare function appLogin(): Promise<{
589
589
  authorizationCode: string;
590
590
  }>;
591
591
 
592
- interface WebViewProps extends Omit<WebViewProps$1, 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
593
- localhostPort?: number;
592
+ interface WebViewProps extends Omit<WebViewProps$1, 'cacheEnabled' | 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
593
+ local: {
594
+ port: number;
595
+ host: number;
596
+ };
594
597
  }
595
- declare function WebView({ localhostPort, onMessage, ...props }: WebViewProps): react_jsx_runtime.JSX.Element;
598
+ declare function WebView({ local, onMessage, ...props }: WebViewProps): react_jsx_runtime.JSX.Element;
596
599
 
597
600
  type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
598
601
  /**
package/dist/index.d.ts CHANGED
@@ -172,7 +172,7 @@ interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation'
172
172
  * useEffect(() => {
173
173
  * return startUpdateLocation({
174
174
  * options: {
175
- * accuracy: Accuracy.Default,
175
+ * accuracy: Accuracy.Balanced,
176
176
  * timeInterval: 3000,
177
177
  * distanceInterval: 10,
178
178
  * },
@@ -589,10 +589,13 @@ declare function appLogin(): Promise<{
589
589
  authorizationCode: string;
590
590
  }>;
591
591
 
592
- interface WebViewProps extends Omit<WebViewProps$1, 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
593
- localhostPort?: number;
592
+ interface WebViewProps extends Omit<WebViewProps$1, 'cacheEnabled' | 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
593
+ local: {
594
+ port: number;
595
+ host: number;
596
+ };
594
597
  }
595
- declare function WebView({ localhostPort, onMessage, ...props }: WebViewProps): react_jsx_runtime.JSX.Element;
598
+ declare function WebView({ local, onMessage, ...props }: WebViewProps): react_jsx_runtime.JSX.Element;
596
599
 
597
600
  type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
598
601
  /**
package/dist/index.js CHANGED
@@ -174,6 +174,14 @@ async function fetchAlbumPhotos(options) {
174
174
  maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
175
175
  maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
176
176
  });
177
+ if (options.base64) {
178
+ return albumPhotos.map((photo) => {
179
+ return {
180
+ ...photo,
181
+ dataUri: `data:image/jpeg;base64,${photo.dataUri}`
182
+ };
183
+ });
184
+ }
177
185
  return albumPhotos;
178
186
  }
179
187
 
@@ -207,17 +215,24 @@ import {
207
215
  WebView as OriginalWebView
208
216
  } from "@react-native-bedrock/native/react-native-webview";
209
217
  import { useMemo } from "react";
210
- import { useBridgeHandler } from "react-native-bedrock";
218
+ import { Bedrock as Bedrock2, useBridgeHandler } from "react-native-bedrock";
211
219
  import * as bridges from "react-native-bedrock/bridges";
212
220
  import * as constantBridges from "react-native-bedrock/constants";
221
+
222
+ // src/env.ts
223
+ var env = {
224
+ getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
225
+ };
226
+
227
+ // src/components/WebView.tsx
213
228
  import { jsx as jsx2 } from "react/jsx-runtime";
214
- function WebView({ localhostPort = 5173, onMessage, ...props }) {
229
+ function WebView({ local, onMessage, ...props }) {
215
230
  const uri = useMemo(() => {
216
231
  if (__DEV__) {
217
- return `http://localhost:${localhostPort}`;
232
+ return `http://${local.host}:${local.port}`;
218
233
  }
219
- return AppsInTossModule.getWebBundleURL({}).url;
220
- }, [localhostPort]);
234
+ return `https://${Bedrock2.appName}.alpha-apps.tossmini.com`;
235
+ }, [local]);
221
236
  const handler = useBridgeHandler({
222
237
  onMessage,
223
238
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -237,9 +252,15 @@ function WebView({ localhostPort = 5173, onMessage, ...props }) {
237
252
  {
238
253
  ref: handler.ref,
239
254
  ...props,
240
- source: { uri },
255
+ source: {
256
+ uri,
257
+ headers: {
258
+ "x-mini-deployment-id": env.getDeploymentId()
259
+ }
260
+ },
241
261
  sharedCookiesEnabled: true,
242
262
  thirdPartyCookiesEnabled: true,
263
+ cacheEnabled: false,
243
264
  onMessage: handler.onMessage,
244
265
  injectedJavaScript: handler.injectedJavaScript,
245
266
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
@@ -270,11 +291,6 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
270
291
  return location;
271
292
  }
272
293
 
273
- // src/env.ts
274
- var env = {
275
- getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
276
- };
277
-
278
294
  // src/types.ts
279
295
  var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
280
296
  Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
@@ -25634,12 +25634,51 @@ var require_archiver = __commonJS({
25634
25634
  }
25635
25635
  });
25636
25636
 
25637
+ // ../../.yarn/unplugged/typia-virtual-7c91ede42e/node_modules/typia/lib/internal/_isFormatUuid.js
25638
+ var require_isFormatUuid = __commonJS({
25639
+ "../../.yarn/unplugged/typia-virtual-7c91ede42e/node_modules/typia/lib/internal/_isFormatUuid.js"(exports2) {
25640
+ "use strict";
25641
+ init_cjs_shims();
25642
+ Object.defineProperty(exports2, "__esModule", { value: true });
25643
+ exports2._isFormatUuid = void 0;
25644
+ var _isFormatUuid2 = (str) => PATTERN.test(str);
25645
+ exports2._isFormatUuid = _isFormatUuid2;
25646
+ var PATTERN = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
25647
+ }
25648
+ });
25649
+
25650
+ // ../../.yarn/unplugged/typia-virtual-7c91ede42e/node_modules/typia/lib/internal/_validateReport.js
25651
+ var require_validateReport = __commonJS({
25652
+ "../../.yarn/unplugged/typia-virtual-7c91ede42e/node_modules/typia/lib/internal/_validateReport.js"(exports2) {
25653
+ "use strict";
25654
+ init_cjs_shims();
25655
+ Object.defineProperty(exports2, "__esModule", { value: true });
25656
+ exports2._validateReport = void 0;
25657
+ var _validateReport2 = (array) => {
25658
+ const reportable = (path13) => {
25659
+ if (array.length === 0)
25660
+ return true;
25661
+ const last = array[array.length - 1].path;
25662
+ return path13.length > last.length || last.substring(0, path13.length) !== path13;
25663
+ };
25664
+ return (exceptable, error) => {
25665
+ if (exceptable && reportable(error.path))
25666
+ array.push(error);
25667
+ return false;
25668
+ };
25669
+ };
25670
+ exports2._validateReport = _validateReport2;
25671
+ }
25672
+ });
25673
+
25637
25674
  // src/plugins/index.ts
25638
25675
  var plugins_exports = {};
25639
25676
  __export(plugins_exports, {
25640
25677
  appsInToss: () => appsInToss,
25641
25678
  appsInTossAppJson: () => appsInTossAppJson,
25642
- createArtifact: () => createArtifact
25679
+ createArtifact: () => createArtifact,
25680
+ validateAppManifest: () => validateAppManifest,
25681
+ validateZip: () => validateZip
25643
25682
  });
25644
25683
  module.exports = __toCommonJS(plugins_exports);
25645
25684
  init_cjs_shims();
@@ -32649,6 +32688,7 @@ function resolveFromRoot(rootDir, request) {
32649
32688
  // src/plugins/utils/createArtifact.ts
32650
32689
  init_cjs_shims();
32651
32690
  var import_path3 = __toESM(require("path"), 1);
32691
+ var import_cli = require("@apps-in-toss/cli");
32652
32692
 
32653
32693
  // src/plugins/utils/compressToZip.ts
32654
32694
  init_cjs_shims();
@@ -32745,7 +32785,209 @@ async function updateAppJsonMetadata(metadata) {
32745
32785
  });
32746
32786
  }
32747
32787
 
32788
+ // src/plugins/types.ts
32789
+ init_cjs_shims();
32790
+ var __typia_transform__isFormatUuid = __toESM(require_isFormatUuid(), 1);
32791
+ var __typia_transform__validateReport = __toESM(require_validateReport(), 1);
32792
+ var validateAppManifest = /* @__PURE__ */ (() => {
32793
+ const _io0 = (input) => "string" === typeof input.appName && (Array.isArray(input.permissions) && input.permissions.every((elem) => "object" === typeof elem && null !== elem && _iu0(elem))) && ("object" === typeof input.oauth && null !== input.oauth && _io6(input.oauth)) && ("object" === typeof input._metadata && null !== input._metadata && _io7(input._metadata));
32794
+ const _io1 = (input) => "clipboard" === input.name && ("read" === input.access || "write" === input.access);
32795
+ const _io2 = (input) => "geolocation" === input.name && "access" === input.access;
32796
+ const _io3 = (input) => "contacts" === input.name && ("read" === input.access || "write" === input.access);
32797
+ const _io4 = (input) => "photos" === input.name && ("read" === input.access || "write" === input.access);
32798
+ const _io5 = (input) => "camera" === input.name && "access" === input.access;
32799
+ const _io6 = (input) => Array.isArray(input.scopes) && input.scopes.every((elem) => "user_name" === elem || "user_phone" === elem || "user_birthday" === elem || "user_ci" === elem || "user_gender" === elem || "user_nationality" === elem || "user_email" === elem);
32800
+ const _io7 = (input) => Array.isArray(input.bundleFiles) && input.bundleFiles.every((elem) => "string" === typeof elem) && ("string" === typeof input.deploymentId && __typia_transform__isFormatUuid._isFormatUuid(input.deploymentId));
32801
+ const _iu0 = (input) => (() => {
32802
+ if ("camera" === input.name)
32803
+ return _io5(input);
32804
+ else if ("photos" === input.name)
32805
+ return _io4(input);
32806
+ else if ("contacts" === input.name)
32807
+ return _io3(input);
32808
+ else if ("geolocation" === input.name)
32809
+ return _io2(input);
32810
+ else if ("clipboard" === input.name)
32811
+ return _io1(input);
32812
+ else
32813
+ return false;
32814
+ })();
32815
+ const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.appName || _report(_exceptionable, {
32816
+ path: _path + ".appName",
32817
+ expected: "string",
32818
+ value: input.appName
32819
+ }), (Array.isArray(input.permissions) || _report(_exceptionable, {
32820
+ path: _path + ".permissions",
32821
+ expected: "Array<Permission>",
32822
+ value: input.permissions
32823
+ })) && input.permissions.map((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
32824
+ path: _path + ".permissions[" + _index4 + "]",
32825
+ expected: "(CameraPermission | ClipboardPermission | ContactsPermission | GeolocationPermission | PhotosPermission)",
32826
+ value: elem
32827
+ })) && _vu0(elem, _path + ".permissions[" + _index4 + "]", _exceptionable) || _report(_exceptionable, {
32828
+ path: _path + ".permissions[" + _index4 + "]",
32829
+ expected: "(CameraPermission | ClipboardPermission | ContactsPermission | GeolocationPermission | PhotosPermission)",
32830
+ value: elem
32831
+ })).every((flag) => flag) || _report(_exceptionable, {
32832
+ path: _path + ".permissions",
32833
+ expected: "Array<Permission>",
32834
+ value: input.permissions
32835
+ }), ("object" === typeof input.oauth && null !== input.oauth || _report(_exceptionable, {
32836
+ path: _path + ".oauth",
32837
+ expected: "__type",
32838
+ value: input.oauth
32839
+ })) && _vo6(input.oauth, _path + ".oauth", _exceptionable) || _report(_exceptionable, {
32840
+ path: _path + ".oauth",
32841
+ expected: "__type",
32842
+ value: input.oauth
32843
+ }), ("object" === typeof input._metadata && null !== input._metadata || _report(_exceptionable, {
32844
+ path: _path + "._metadata",
32845
+ expected: "__type.o1",
32846
+ value: input._metadata
32847
+ })) && _vo7(input._metadata, _path + "._metadata", _exceptionable) || _report(_exceptionable, {
32848
+ path: _path + "._metadata",
32849
+ expected: "__type.o1",
32850
+ value: input._metadata
32851
+ })].every((flag) => flag);
32852
+ const _vo1 = (input, _path, _exceptionable = true) => ["clipboard" === input.name || _report(_exceptionable, {
32853
+ path: _path + ".name",
32854
+ expected: '"clipboard"',
32855
+ value: input.name
32856
+ }), "read" === input.access || "write" === input.access || _report(_exceptionable, {
32857
+ path: _path + ".access",
32858
+ expected: '("read" | "write")',
32859
+ value: input.access
32860
+ })].every((flag) => flag);
32861
+ const _vo2 = (input, _path, _exceptionable = true) => ["geolocation" === input.name || _report(_exceptionable, {
32862
+ path: _path + ".name",
32863
+ expected: '"geolocation"',
32864
+ value: input.name
32865
+ }), "access" === input.access || _report(_exceptionable, {
32866
+ path: _path + ".access",
32867
+ expected: '"access"',
32868
+ value: input.access
32869
+ })].every((flag) => flag);
32870
+ const _vo3 = (input, _path, _exceptionable = true) => ["contacts" === input.name || _report(_exceptionable, {
32871
+ path: _path + ".name",
32872
+ expected: '"contacts"',
32873
+ value: input.name
32874
+ }), "read" === input.access || "write" === input.access || _report(_exceptionable, {
32875
+ path: _path + ".access",
32876
+ expected: '("read" | "write")',
32877
+ value: input.access
32878
+ })].every((flag) => flag);
32879
+ const _vo4 = (input, _path, _exceptionable = true) => ["photos" === input.name || _report(_exceptionable, {
32880
+ path: _path + ".name",
32881
+ expected: '"photos"',
32882
+ value: input.name
32883
+ }), "read" === input.access || "write" === input.access || _report(_exceptionable, {
32884
+ path: _path + ".access",
32885
+ expected: '("read" | "write")',
32886
+ value: input.access
32887
+ })].every((flag) => flag);
32888
+ const _vo5 = (input, _path, _exceptionable = true) => ["camera" === input.name || _report(_exceptionable, {
32889
+ path: _path + ".name",
32890
+ expected: '"camera"',
32891
+ value: input.name
32892
+ }), "access" === input.access || _report(_exceptionable, {
32893
+ path: _path + ".access",
32894
+ expected: '"access"',
32895
+ value: input.access
32896
+ })].every((flag) => flag);
32897
+ const _vo6 = (input, _path, _exceptionable = true) => [(Array.isArray(input.scopes) || _report(_exceptionable, {
32898
+ path: _path + ".scopes",
32899
+ expected: "Array<OAuthScope>",
32900
+ value: input.scopes
32901
+ })) && input.scopes.map((elem, _index5) => "user_name" === elem || "user_phone" === elem || "user_birthday" === elem || "user_ci" === elem || "user_gender" === elem || "user_nationality" === elem || "user_email" === elem || _report(_exceptionable, {
32902
+ path: _path + ".scopes[" + _index5 + "]",
32903
+ expected: '("user_birthday" | "user_ci" | "user_email" | "user_gender" | "user_name" | "user_nationality" | "user_phone")',
32904
+ value: elem
32905
+ })).every((flag) => flag) || _report(_exceptionable, {
32906
+ path: _path + ".scopes",
32907
+ expected: "Array<OAuthScope>",
32908
+ value: input.scopes
32909
+ })].every((flag) => flag);
32910
+ const _vo7 = (input, _path, _exceptionable = true) => [(Array.isArray(input.bundleFiles) || _report(_exceptionable, {
32911
+ path: _path + ".bundleFiles",
32912
+ expected: "Array<string>",
32913
+ value: input.bundleFiles
32914
+ })) && input.bundleFiles.map((elem, _index6) => "string" === typeof elem || _report(_exceptionable, {
32915
+ path: _path + ".bundleFiles[" + _index6 + "]",
32916
+ expected: "string",
32917
+ value: elem
32918
+ })).every((flag) => flag) || _report(_exceptionable, {
32919
+ path: _path + ".bundleFiles",
32920
+ expected: "Array<string>",
32921
+ value: input.bundleFiles
32922
+ }), "string" === typeof input.deploymentId && (__typia_transform__isFormatUuid._isFormatUuid(input.deploymentId) || _report(_exceptionable, {
32923
+ path: _path + ".deploymentId",
32924
+ expected: 'string & Format<"uuid">',
32925
+ value: input.deploymentId
32926
+ })) || _report(_exceptionable, {
32927
+ path: _path + ".deploymentId",
32928
+ expected: '(string & Format<"uuid">)',
32929
+ value: input.deploymentId
32930
+ })].every((flag) => flag);
32931
+ const _vu0 = (input, _path, _exceptionable = true) => (() => {
32932
+ if ("camera" === input.name)
32933
+ return _vo5(input, _path, _exceptionable);
32934
+ else if ("photos" === input.name)
32935
+ return _vo4(input, _path, _exceptionable);
32936
+ else if ("contacts" === input.name)
32937
+ return _vo3(input, _path, _exceptionable);
32938
+ else if ("geolocation" === input.name)
32939
+ return _vo2(input, _path, _exceptionable);
32940
+ else if ("clipboard" === input.name)
32941
+ return _vo1(input, _path, _exceptionable);
32942
+ else
32943
+ return _report(_exceptionable, {
32944
+ path: _path,
32945
+ expected: "(CameraPermission | PhotosPermission | ContactsPermission | GeolocationPermission | ClipboardPermission)",
32946
+ value: input
32947
+ });
32948
+ })();
32949
+ const __is = (input) => "object" === typeof input && null !== input && _io0(input);
32950
+ let errors;
32951
+ let _report;
32952
+ return (input) => {
32953
+ if (false === __is(input)) {
32954
+ errors = [];
32955
+ _report = __typia_transform__validateReport._validateReport(errors);
32956
+ ((input2, _path, _exceptionable = true) => ("object" === typeof input2 && null !== input2 || _report(true, {
32957
+ path: _path + "",
32958
+ expected: "AppManifest",
32959
+ value: input2
32960
+ })) && _vo0(input2, _path + "", true) || _report(true, {
32961
+ path: _path + "",
32962
+ expected: "AppManifest",
32963
+ value: input2
32964
+ }))(input, "$input", true);
32965
+ const success = 0 === errors.length;
32966
+ return success ? {
32967
+ success,
32968
+ data: input
32969
+ } : {
32970
+ success,
32971
+ errors,
32972
+ data: input
32973
+ };
32974
+ }
32975
+ return {
32976
+ success: true,
32977
+ data: input
32978
+ };
32979
+ };
32980
+ })();
32981
+
32748
32982
  // src/plugins/utils/createArtifact.ts
32983
+ async function validateZip(zipPath) {
32984
+ const appJsonString = await (0, import_cli.readZipContent)(zipPath, "app.json");
32985
+ const appJson = JSON.parse(appJsonString);
32986
+ const validated = validateAppManifest(appJson);
32987
+ if (!validated.success) {
32988
+ throw new Error("bedrock.config.ts \uAC12\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
32989
+ }
32990
+ }
32749
32991
  async function createArtifact(options, deps) {
32750
32992
  const { inputJsFiles, outfile, appJsonPath, reactNativeVersion } = options;
32751
32993
  const bundleFiles = await Promise.all(
@@ -32762,6 +33004,7 @@ async function createArtifact(options, deps) {
32762
33004
  files: [{ path: appJsonPath, name: "app.json" }, ...bundleFiles, ...options.additionalFilesToZip ?? []],
32763
33005
  outfile
32764
33006
  });
33007
+ await validateZip(outfile);
32765
33008
  return outfile;
32766
33009
  }
32767
33010
 
@@ -33286,14 +33529,13 @@ function appsInToss(options) {
33286
33529
  appsInTossEsbuildConfig(deploymentId)
33287
33530
  ];
33288
33531
  }
33289
-
33290
- // src/plugins/types.ts
33291
- init_cjs_shims();
33292
33532
  // Annotate the CommonJS export names for ESM import in node:
33293
33533
  0 && (module.exports = {
33294
33534
  appsInToss,
33295
33535
  appsInTossAppJson,
33296
- createArtifact
33536
+ createArtifact,
33537
+ validateAppManifest,
33538
+ validateZip
33297
33539
  });
33298
33540
  /*! Bundled license information:
33299
33541
 
@@ -1,4 +1,5 @@
1
1
  import { BedrockPluginCore } from 'react-native-bedrock/config';
2
+ import typia, { tags } from 'typia';
2
3
 
3
4
  type PermissionReadWrite = 'read' | 'write';
4
5
  type PermissionAccess = 'access';
@@ -41,7 +42,12 @@ type AppManifest = {
41
42
  oauth: {
42
43
  scopes: OAuthScope[];
43
44
  };
45
+ _metadata: {
46
+ bundleFiles: string[];
47
+ deploymentId: string & tags.Format<'uuid'>;
48
+ };
44
49
  };
50
+ declare const validateAppManifest: (input: unknown) => typia.IValidation<AppManifest>;
45
51
 
46
52
  interface AppsInTossPluginOptions {
47
53
  permissions: AppManifest['permissions'];
@@ -80,6 +86,7 @@ interface CreateArtifactOptions {
80
86
  name: string;
81
87
  }[];
82
88
  }
89
+ declare function validateZip(zipPath: string): Promise<void>;
83
90
  declare function createArtifact(options: CreateArtifactOptions, deps: CreateCompressedBytecodeDependencies): Promise<string>;
84
91
 
85
- export { type AppManifest, type AppsInTossPluginOptions, type BuildResult, type CreateArtifactOptions, type OAuthScope, type Permission, appsInToss, appsInTossAppJson, createArtifact };
92
+ export { type AppManifest, type AppsInTossPluginOptions, type BuildResult, type CreateArtifactOptions, type OAuthScope, type Permission, appsInToss, appsInTossAppJson, createArtifact, validateAppManifest, validateZip };
@@ -1,4 +1,5 @@
1
1
  import { BedrockPluginCore } from 'react-native-bedrock/config';
2
+ import typia, { tags } from 'typia';
2
3
 
3
4
  type PermissionReadWrite = 'read' | 'write';
4
5
  type PermissionAccess = 'access';
@@ -41,7 +42,12 @@ type AppManifest = {
41
42
  oauth: {
42
43
  scopes: OAuthScope[];
43
44
  };
45
+ _metadata: {
46
+ bundleFiles: string[];
47
+ deploymentId: string & tags.Format<'uuid'>;
48
+ };
44
49
  };
50
+ declare const validateAppManifest: (input: unknown) => typia.IValidation<AppManifest>;
45
51
 
46
52
  interface AppsInTossPluginOptions {
47
53
  permissions: AppManifest['permissions'];
@@ -80,6 +86,7 @@ interface CreateArtifactOptions {
80
86
  name: string;
81
87
  }[];
82
88
  }
89
+ declare function validateZip(zipPath: string): Promise<void>;
83
90
  declare function createArtifact(options: CreateArtifactOptions, deps: CreateCompressedBytecodeDependencies): Promise<string>;
84
91
 
85
- export { type AppManifest, type AppsInTossPluginOptions, type BuildResult, type CreateArtifactOptions, type OAuthScope, type Permission, appsInToss, appsInTossAppJson, createArtifact };
92
+ export { type AppManifest, type AppsInTossPluginOptions, type BuildResult, type CreateArtifactOptions, type OAuthScope, type Permission, appsInToss, appsInTossAppJson, createArtifact, validateAppManifest, validateZip };
@@ -25639,6 +25639,43 @@ var require_archiver = __commonJS({
25639
25639
  }
25640
25640
  });
25641
25641
 
25642
+ // ../../.yarn/unplugged/typia-virtual-7c91ede42e/node_modules/typia/lib/internal/_isFormatUuid.js
25643
+ var require_isFormatUuid = __commonJS({
25644
+ "../../.yarn/unplugged/typia-virtual-7c91ede42e/node_modules/typia/lib/internal/_isFormatUuid.js"(exports) {
25645
+ "use strict";
25646
+ init_esm_shims();
25647
+ Object.defineProperty(exports, "__esModule", { value: true });
25648
+ exports._isFormatUuid = void 0;
25649
+ var _isFormatUuid2 = (str) => PATTERN.test(str);
25650
+ exports._isFormatUuid = _isFormatUuid2;
25651
+ var PATTERN = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
25652
+ }
25653
+ });
25654
+
25655
+ // ../../.yarn/unplugged/typia-virtual-7c91ede42e/node_modules/typia/lib/internal/_validateReport.js
25656
+ var require_validateReport = __commonJS({
25657
+ "../../.yarn/unplugged/typia-virtual-7c91ede42e/node_modules/typia/lib/internal/_validateReport.js"(exports) {
25658
+ "use strict";
25659
+ init_esm_shims();
25660
+ Object.defineProperty(exports, "__esModule", { value: true });
25661
+ exports._validateReport = void 0;
25662
+ var _validateReport2 = (array) => {
25663
+ const reportable = (path13) => {
25664
+ if (array.length === 0)
25665
+ return true;
25666
+ const last = array[array.length - 1].path;
25667
+ return path13.length > last.length || last.substring(0, path13.length) !== path13;
25668
+ };
25669
+ return (exceptable, error) => {
25670
+ if (exceptable && reportable(error.path))
25671
+ array.push(error);
25672
+ return false;
25673
+ };
25674
+ };
25675
+ exports._validateReport = _validateReport2;
25676
+ }
25677
+ });
25678
+
25642
25679
  // src/plugins/index.ts
25643
25680
  init_esm_shims();
25644
25681
 
@@ -32652,6 +32689,7 @@ function resolveFromRoot(rootDir, request) {
32652
32689
  // src/plugins/utils/createArtifact.ts
32653
32690
  init_esm_shims();
32654
32691
  import path11 from "path";
32692
+ import { readZipContent } from "@apps-in-toss/cli";
32655
32693
 
32656
32694
  // src/plugins/utils/compressToZip.ts
32657
32695
  init_esm_shims();
@@ -32748,7 +32786,209 @@ async function updateAppJsonMetadata(metadata) {
32748
32786
  });
32749
32787
  }
32750
32788
 
32789
+ // src/plugins/types.ts
32790
+ init_esm_shims();
32791
+ var __typia_transform__isFormatUuid = __toESM(require_isFormatUuid(), 1);
32792
+ var __typia_transform__validateReport = __toESM(require_validateReport(), 1);
32793
+ var validateAppManifest = /* @__PURE__ */ (() => {
32794
+ const _io0 = (input) => "string" === typeof input.appName && (Array.isArray(input.permissions) && input.permissions.every((elem) => "object" === typeof elem && null !== elem && _iu0(elem))) && ("object" === typeof input.oauth && null !== input.oauth && _io6(input.oauth)) && ("object" === typeof input._metadata && null !== input._metadata && _io7(input._metadata));
32795
+ const _io1 = (input) => "clipboard" === input.name && ("read" === input.access || "write" === input.access);
32796
+ const _io2 = (input) => "geolocation" === input.name && "access" === input.access;
32797
+ const _io3 = (input) => "contacts" === input.name && ("read" === input.access || "write" === input.access);
32798
+ const _io4 = (input) => "photos" === input.name && ("read" === input.access || "write" === input.access);
32799
+ const _io5 = (input) => "camera" === input.name && "access" === input.access;
32800
+ const _io6 = (input) => Array.isArray(input.scopes) && input.scopes.every((elem) => "user_name" === elem || "user_phone" === elem || "user_birthday" === elem || "user_ci" === elem || "user_gender" === elem || "user_nationality" === elem || "user_email" === elem);
32801
+ const _io7 = (input) => Array.isArray(input.bundleFiles) && input.bundleFiles.every((elem) => "string" === typeof elem) && ("string" === typeof input.deploymentId && __typia_transform__isFormatUuid._isFormatUuid(input.deploymentId));
32802
+ const _iu0 = (input) => (() => {
32803
+ if ("camera" === input.name)
32804
+ return _io5(input);
32805
+ else if ("photos" === input.name)
32806
+ return _io4(input);
32807
+ else if ("contacts" === input.name)
32808
+ return _io3(input);
32809
+ else if ("geolocation" === input.name)
32810
+ return _io2(input);
32811
+ else if ("clipboard" === input.name)
32812
+ return _io1(input);
32813
+ else
32814
+ return false;
32815
+ })();
32816
+ const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.appName || _report(_exceptionable, {
32817
+ path: _path + ".appName",
32818
+ expected: "string",
32819
+ value: input.appName
32820
+ }), (Array.isArray(input.permissions) || _report(_exceptionable, {
32821
+ path: _path + ".permissions",
32822
+ expected: "Array<Permission>",
32823
+ value: input.permissions
32824
+ })) && input.permissions.map((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
32825
+ path: _path + ".permissions[" + _index4 + "]",
32826
+ expected: "(CameraPermission | ClipboardPermission | ContactsPermission | GeolocationPermission | PhotosPermission)",
32827
+ value: elem
32828
+ })) && _vu0(elem, _path + ".permissions[" + _index4 + "]", _exceptionable) || _report(_exceptionable, {
32829
+ path: _path + ".permissions[" + _index4 + "]",
32830
+ expected: "(CameraPermission | ClipboardPermission | ContactsPermission | GeolocationPermission | PhotosPermission)",
32831
+ value: elem
32832
+ })).every((flag) => flag) || _report(_exceptionable, {
32833
+ path: _path + ".permissions",
32834
+ expected: "Array<Permission>",
32835
+ value: input.permissions
32836
+ }), ("object" === typeof input.oauth && null !== input.oauth || _report(_exceptionable, {
32837
+ path: _path + ".oauth",
32838
+ expected: "__type",
32839
+ value: input.oauth
32840
+ })) && _vo6(input.oauth, _path + ".oauth", _exceptionable) || _report(_exceptionable, {
32841
+ path: _path + ".oauth",
32842
+ expected: "__type",
32843
+ value: input.oauth
32844
+ }), ("object" === typeof input._metadata && null !== input._metadata || _report(_exceptionable, {
32845
+ path: _path + "._metadata",
32846
+ expected: "__type.o1",
32847
+ value: input._metadata
32848
+ })) && _vo7(input._metadata, _path + "._metadata", _exceptionable) || _report(_exceptionable, {
32849
+ path: _path + "._metadata",
32850
+ expected: "__type.o1",
32851
+ value: input._metadata
32852
+ })].every((flag) => flag);
32853
+ const _vo1 = (input, _path, _exceptionable = true) => ["clipboard" === input.name || _report(_exceptionable, {
32854
+ path: _path + ".name",
32855
+ expected: '"clipboard"',
32856
+ value: input.name
32857
+ }), "read" === input.access || "write" === input.access || _report(_exceptionable, {
32858
+ path: _path + ".access",
32859
+ expected: '("read" | "write")',
32860
+ value: input.access
32861
+ })].every((flag) => flag);
32862
+ const _vo2 = (input, _path, _exceptionable = true) => ["geolocation" === input.name || _report(_exceptionable, {
32863
+ path: _path + ".name",
32864
+ expected: '"geolocation"',
32865
+ value: input.name
32866
+ }), "access" === input.access || _report(_exceptionable, {
32867
+ path: _path + ".access",
32868
+ expected: '"access"',
32869
+ value: input.access
32870
+ })].every((flag) => flag);
32871
+ const _vo3 = (input, _path, _exceptionable = true) => ["contacts" === input.name || _report(_exceptionable, {
32872
+ path: _path + ".name",
32873
+ expected: '"contacts"',
32874
+ value: input.name
32875
+ }), "read" === input.access || "write" === input.access || _report(_exceptionable, {
32876
+ path: _path + ".access",
32877
+ expected: '("read" | "write")',
32878
+ value: input.access
32879
+ })].every((flag) => flag);
32880
+ const _vo4 = (input, _path, _exceptionable = true) => ["photos" === input.name || _report(_exceptionable, {
32881
+ path: _path + ".name",
32882
+ expected: '"photos"',
32883
+ value: input.name
32884
+ }), "read" === input.access || "write" === input.access || _report(_exceptionable, {
32885
+ path: _path + ".access",
32886
+ expected: '("read" | "write")',
32887
+ value: input.access
32888
+ })].every((flag) => flag);
32889
+ const _vo5 = (input, _path, _exceptionable = true) => ["camera" === input.name || _report(_exceptionable, {
32890
+ path: _path + ".name",
32891
+ expected: '"camera"',
32892
+ value: input.name
32893
+ }), "access" === input.access || _report(_exceptionable, {
32894
+ path: _path + ".access",
32895
+ expected: '"access"',
32896
+ value: input.access
32897
+ })].every((flag) => flag);
32898
+ const _vo6 = (input, _path, _exceptionable = true) => [(Array.isArray(input.scopes) || _report(_exceptionable, {
32899
+ path: _path + ".scopes",
32900
+ expected: "Array<OAuthScope>",
32901
+ value: input.scopes
32902
+ })) && input.scopes.map((elem, _index5) => "user_name" === elem || "user_phone" === elem || "user_birthday" === elem || "user_ci" === elem || "user_gender" === elem || "user_nationality" === elem || "user_email" === elem || _report(_exceptionable, {
32903
+ path: _path + ".scopes[" + _index5 + "]",
32904
+ expected: '("user_birthday" | "user_ci" | "user_email" | "user_gender" | "user_name" | "user_nationality" | "user_phone")',
32905
+ value: elem
32906
+ })).every((flag) => flag) || _report(_exceptionable, {
32907
+ path: _path + ".scopes",
32908
+ expected: "Array<OAuthScope>",
32909
+ value: input.scopes
32910
+ })].every((flag) => flag);
32911
+ const _vo7 = (input, _path, _exceptionable = true) => [(Array.isArray(input.bundleFiles) || _report(_exceptionable, {
32912
+ path: _path + ".bundleFiles",
32913
+ expected: "Array<string>",
32914
+ value: input.bundleFiles
32915
+ })) && input.bundleFiles.map((elem, _index6) => "string" === typeof elem || _report(_exceptionable, {
32916
+ path: _path + ".bundleFiles[" + _index6 + "]",
32917
+ expected: "string",
32918
+ value: elem
32919
+ })).every((flag) => flag) || _report(_exceptionable, {
32920
+ path: _path + ".bundleFiles",
32921
+ expected: "Array<string>",
32922
+ value: input.bundleFiles
32923
+ }), "string" === typeof input.deploymentId && (__typia_transform__isFormatUuid._isFormatUuid(input.deploymentId) || _report(_exceptionable, {
32924
+ path: _path + ".deploymentId",
32925
+ expected: 'string & Format<"uuid">',
32926
+ value: input.deploymentId
32927
+ })) || _report(_exceptionable, {
32928
+ path: _path + ".deploymentId",
32929
+ expected: '(string & Format<"uuid">)',
32930
+ value: input.deploymentId
32931
+ })].every((flag) => flag);
32932
+ const _vu0 = (input, _path, _exceptionable = true) => (() => {
32933
+ if ("camera" === input.name)
32934
+ return _vo5(input, _path, _exceptionable);
32935
+ else if ("photos" === input.name)
32936
+ return _vo4(input, _path, _exceptionable);
32937
+ else if ("contacts" === input.name)
32938
+ return _vo3(input, _path, _exceptionable);
32939
+ else if ("geolocation" === input.name)
32940
+ return _vo2(input, _path, _exceptionable);
32941
+ else if ("clipboard" === input.name)
32942
+ return _vo1(input, _path, _exceptionable);
32943
+ else
32944
+ return _report(_exceptionable, {
32945
+ path: _path,
32946
+ expected: "(CameraPermission | PhotosPermission | ContactsPermission | GeolocationPermission | ClipboardPermission)",
32947
+ value: input
32948
+ });
32949
+ })();
32950
+ const __is = (input) => "object" === typeof input && null !== input && _io0(input);
32951
+ let errors;
32952
+ let _report;
32953
+ return (input) => {
32954
+ if (false === __is(input)) {
32955
+ errors = [];
32956
+ _report = __typia_transform__validateReport._validateReport(errors);
32957
+ ((input2, _path, _exceptionable = true) => ("object" === typeof input2 && null !== input2 || _report(true, {
32958
+ path: _path + "",
32959
+ expected: "AppManifest",
32960
+ value: input2
32961
+ })) && _vo0(input2, _path + "", true) || _report(true, {
32962
+ path: _path + "",
32963
+ expected: "AppManifest",
32964
+ value: input2
32965
+ }))(input, "$input", true);
32966
+ const success = 0 === errors.length;
32967
+ return success ? {
32968
+ success,
32969
+ data: input
32970
+ } : {
32971
+ success,
32972
+ errors,
32973
+ data: input
32974
+ };
32975
+ }
32976
+ return {
32977
+ success: true,
32978
+ data: input
32979
+ };
32980
+ };
32981
+ })();
32982
+
32751
32983
  // src/plugins/utils/createArtifact.ts
32984
+ async function validateZip(zipPath) {
32985
+ const appJsonString = await readZipContent(zipPath, "app.json");
32986
+ const appJson = JSON.parse(appJsonString);
32987
+ const validated = validateAppManifest(appJson);
32988
+ if (!validated.success) {
32989
+ throw new Error("bedrock.config.ts \uAC12\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
32990
+ }
32991
+ }
32752
32992
  async function createArtifact(options, deps) {
32753
32993
  const { inputJsFiles, outfile, appJsonPath, reactNativeVersion } = options;
32754
32994
  const bundleFiles = await Promise.all(
@@ -32765,6 +33005,7 @@ async function createArtifact(options, deps) {
32765
33005
  files: [{ path: appJsonPath, name: "app.json" }, ...bundleFiles, ...options.additionalFilesToZip ?? []],
32766
33006
  outfile
32767
33007
  });
33008
+ await validateZip(outfile);
32768
33009
  return outfile;
32769
33010
  }
32770
33011
 
@@ -33289,13 +33530,12 @@ function appsInToss(options) {
33289
33530
  appsInTossEsbuildConfig(deploymentId)
33290
33531
  ];
33291
33532
  }
33292
-
33293
- // src/plugins/types.ts
33294
- init_esm_shims();
33295
33533
  export {
33296
33534
  appsInToss,
33297
33535
  appsInTossAppJson,
33298
- createArtifact
33536
+ createArtifact,
33537
+ validateAppManifest,
33538
+ validateZip
33299
33539
  };
33300
33540
  /*! Bundled license information:
33301
33541
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/framework",
3
3
  "type": "module",
4
- "version": "0.0.0-dev.1741675190621",
4
+ "version": "0.0.0-dev.1741859884482",
5
5
  "description": "The framework for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -45,11 +45,12 @@
45
45
  "ait": "./bin/ait.js"
46
46
  },
47
47
  "dependencies": {
48
- "@apps-in-toss/cli": "0.0.0-dev.1741675190621"
48
+ "@apps-in-toss/cli": "0.0.0-dev.1741859884482"
49
49
  },
50
50
  "devDependencies": {
51
- "@react-native-bedrock/mpack-next": "0.0.0-dev.1741675002593",
52
- "@react-native-bedrock/native": "0.0.0-dev.1741675002593",
51
+ "@react-native-bedrock/mpack-next": "0.0.12",
52
+ "@react-native-bedrock/native": "0.0.12",
53
+ "@ryoppippi/unplugin-typia": "^2.0.3",
53
54
  "@toss-design-system/react-native": "^0",
54
55
  "@types/archiver": "^6.0.3",
55
56
  "@types/connect": "^3",
@@ -61,9 +62,10 @@
61
62
  "picocolors": "^1.1.1",
62
63
  "react": "18.2.0",
63
64
  "react-native": "0.72.6",
64
- "react-native-bedrock": "0.0.0-dev.1741675002593",
65
+ "react-native-bedrock": "0.0.12",
65
66
  "tsup": "^8.3.5",
66
67
  "typescript": "4.9.5",
68
+ "typia": "^8.0.1",
67
69
  "uuidv7": "^1.0.2",
68
70
  "vitest": "^3.0.3"
69
71
  },
@@ -78,5 +80,5 @@
78
80
  "publishConfig": {
79
81
  "access": "public"
80
82
  },
81
- "gitHead": "6187ae5debf7ce5f46d4c6274fac9b26df728392"
83
+ "gitHead": "3be5cb5032d4e429e47b30124a608440032fff3d"
82
84
  }