@expo/cli 1.0.0-canary-20250131-5c4e588 → 1.0.0-canary-20250219-4a5dade

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.
Files changed (34) hide show
  1. package/build/bin/cli +1 -1
  2. package/build/src/api/getNativeModuleVersions.js +1 -1
  3. package/build/src/api/getNativeModuleVersions.js.map +1 -1
  4. package/build/src/api/graphql/types/App.js +1 -0
  5. package/build/src/api/graphql/types/App.js.map +1 -1
  6. package/build/src/api/rest/cache/FileSystemResponseCache.js +129 -50
  7. package/build/src/api/rest/cache/FileSystemResponseCache.js.map +1 -1
  8. package/build/src/graphql/generated.js +494 -23
  9. package/build/src/graphql/generated.js.map +1 -1
  10. package/build/src/prebuild/configureProjectAsync.js +2 -2
  11. package/build/src/prebuild/configureProjectAsync.js.map +1 -1
  12. package/build/src/prebuild/ensureConfigAsync.js +2 -2
  13. package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
  14. package/build/src/start/resolveOptions.js +5 -0
  15. package/build/src/start/resolveOptions.js.map +1 -1
  16. package/build/src/start/server/AsyncWsTunnel.js +159 -0
  17. package/build/src/start/server/AsyncWsTunnel.js.map +1 -0
  18. package/build/src/start/server/BundlerDevServer.js +17 -10
  19. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  20. package/build/src/start/server/metro/withMetroMultiPlatform.js +1 -1
  21. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  22. package/build/src/start/server/middleware/DomComponentsMiddleware.js +1 -1
  23. package/build/src/start/server/middleware/DomComponentsMiddleware.js.map +1 -1
  24. package/build/src/start/server/middleware/metroOptions.js +1 -1
  25. package/build/src/start/server/middleware/metroOptions.js.map +1 -1
  26. package/build/src/utils/env.js +30 -5
  27. package/build/src/utils/env.js.map +1 -1
  28. package/build/src/utils/getOrPromptApplicationId.js +53 -20
  29. package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
  30. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  31. package/build/src/utils/telemetry/utils/context.js +1 -1
  32. package/package.json +16 -16
  33. package/build/src/utils/getAccountUsername.js +0 -22
  34. package/build/src/utils/getAccountUsername.js.map +0 -1
package/build/bin/cli CHANGED
@@ -121,7 +121,7 @@ const args = (0, _arg().default)({
121
121
  });
122
122
  if (args["--version"]) {
123
123
  // Version is added in the build script.
124
- console.log("1.0.0-canary-20250131-5c4e588");
124
+ console.log("1.0.0-canary-20250219-4a5dade");
125
125
  process.exit(0);
126
126
  }
127
127
  if (args["--non-interactive"]) {
@@ -12,7 +12,7 @@ async function getNativeModuleVersionsAsync(sdkVersion) {
12
12
  const fetchAsync = (0, _client.createCachedFetch)({
13
13
  cacheDirectory: "native-modules-cache",
14
14
  // 1 minute cache
15
- ttl: 1000 * 60 * 1
15
+ ttl: 1000 * 60
16
16
  });
17
17
  const response = await fetchAsync(`sdks/${sdkVersion}/native-modules`);
18
18
  if (!response.ok) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/api/getNativeModuleVersions.ts"],"sourcesContent":["import { createCachedFetch, getResponseDataOrThrow } from './rest/client';\nimport { CommandError } from '../utils/errors';\n\ninterface NativeModule {\n npmPackage: string;\n versionRange: string;\n}\ntype BundledNativeModuleList = NativeModule[];\n\nexport type BundledNativeModules = Record<string, string>;\n\n/**\n * The endpoint returns the list of bundled native modules for a given SDK version.\n * The data is populated by the `et sync-bundled-native-modules` script from expo/expo repo.\n * See the code for more details:\n * https://github.com/expo/expo/blob/main/tools/src/commands/SyncBundledNativeModules.ts\n *\n * Example result:\n * [\n * {\n * id: \"79285187-e5c4-47f7-b6a9-664f5d16f0db\",\n * sdkVersion: \"41.0.0\",\n * npmPackage: \"expo-camera\",\n * versionRange: \"~10.1.0\",\n * createdAt: \"2021-04-29T09:34:32.825Z\",\n * updatedAt: \"2021-04-29T09:34:32.825Z\"\n * },\n * ...\n * ]\n */\nexport async function getNativeModuleVersionsAsync(\n sdkVersion: string\n): Promise<BundledNativeModules> {\n const fetchAsync = createCachedFetch({\n cacheDirectory: 'native-modules-cache',\n // 1 minute cache\n ttl: 1000 * 60 * 1,\n });\n const response = await fetchAsync(`sdks/${sdkVersion}/native-modules`);\n if (!response.ok) {\n throw new CommandError(\n 'API',\n `Unexpected response when fetching version info from Expo servers: ${response.statusText}.`\n );\n }\n\n const json = await response.json();\n const data = getResponseDataOrThrow<BundledNativeModuleList>(json);\n if (!data.length) {\n throw new CommandError('VERSIONS', 'The bundled native module list from the Expo API is empty');\n }\n return fromBundledNativeModuleList(data);\n}\n\nfunction fromBundledNativeModuleList(list: BundledNativeModuleList): BundledNativeModules {\n return list.reduce((acc, i) => {\n acc[i.npmPackage] = i.versionRange;\n return acc;\n }, {} as BundledNativeModules);\n}\n"],"names":["getNativeModuleVersionsAsync","sdkVersion","fetchAsync","createCachedFetch","cacheDirectory","ttl","response","ok","CommandError","statusText","json","data","getResponseDataOrThrow","length","fromBundledNativeModuleList","list","reduce","acc","i","npmPackage","versionRange"],"mappings":"AAAA;;;;+BA8BsBA,8BAA4B;;aAA5BA,4BAA4B;;wBA9BQ,eAAe;wBAC5C,iBAAiB;AA6BvC,eAAeA,4BAA4B,CAChDC,UAAkB,EACa;IAC/B,MAAMC,UAAU,GAAGC,IAAAA,OAAiB,kBAAA,EAAC;QACnCC,cAAc,EAAE,sBAAsB;QACtC,iBAAiB;QACjBC,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,CAAC;KACnB,CAAC,AAAC;IACH,MAAMC,QAAQ,GAAG,MAAMJ,UAAU,CAAC,CAAC,KAAK,EAAED,UAAU,CAAC,eAAe,CAAC,CAAC,AAAC;IACvE,IAAI,CAACK,QAAQ,CAACC,EAAE,EAAE;QAChB,MAAM,IAAIC,OAAY,aAAA,CACpB,KAAK,EACL,CAAC,kEAAkE,EAAEF,QAAQ,CAACG,UAAU,CAAC,CAAC,CAAC,CAC5F,CAAC;IACJ,CAAC;IAED,MAAMC,IAAI,GAAG,MAAMJ,QAAQ,CAACI,IAAI,EAAE,AAAC;IACnC,MAAMC,IAAI,GAAGC,IAAAA,OAAsB,uBAAA,EAA0BF,IAAI,CAAC,AAAC;IACnE,IAAI,CAACC,IAAI,CAACE,MAAM,EAAE;QAChB,MAAM,IAAIL,OAAY,aAAA,CAAC,UAAU,EAAE,2DAA2D,CAAC,CAAC;IAClG,CAAC;IACD,OAAOM,2BAA2B,CAACH,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED,SAASG,2BAA2B,CAACC,IAA6B,EAAwB;IACxF,OAAOA,IAAI,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,CAAC,GAAK;QAC7BD,GAAG,CAACC,CAAC,CAACC,UAAU,CAAC,GAAGD,CAAC,CAACE,YAAY,CAAC;QACnC,OAAOH,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAyB,CAAC;AACjC,CAAC"}
1
+ {"version":3,"sources":["../../../src/api/getNativeModuleVersions.ts"],"sourcesContent":["import { createCachedFetch, getResponseDataOrThrow } from './rest/client';\nimport { CommandError } from '../utils/errors';\n\ninterface NativeModule {\n npmPackage: string;\n versionRange: string;\n}\ntype BundledNativeModuleList = NativeModule[];\n\nexport type BundledNativeModules = Record<string, string>;\n\n/**\n * The endpoint returns the list of bundled native modules for a given SDK version.\n * The data is populated by the `et sync-bundled-native-modules` script from expo/expo repo.\n * See the code for more details:\n * https://github.com/expo/expo/blob/main/tools/src/commands/SyncBundledNativeModules.ts\n *\n * Example result:\n * [\n * {\n * id: \"79285187-e5c4-47f7-b6a9-664f5d16f0db\",\n * sdkVersion: \"41.0.0\",\n * npmPackage: \"expo-camera\",\n * versionRange: \"~10.1.0\",\n * createdAt: \"2021-04-29T09:34:32.825Z\",\n * updatedAt: \"2021-04-29T09:34:32.825Z\"\n * },\n * ...\n * ]\n */\nexport async function getNativeModuleVersionsAsync(\n sdkVersion: string\n): Promise<BundledNativeModules> {\n const fetchAsync = createCachedFetch({\n cacheDirectory: 'native-modules-cache',\n // 1 minute cache\n ttl: 1000 * 60,\n });\n const response = await fetchAsync(`sdks/${sdkVersion}/native-modules`);\n if (!response.ok) {\n throw new CommandError(\n 'API',\n `Unexpected response when fetching version info from Expo servers: ${response.statusText}.`\n );\n }\n\n const json = await response.json();\n const data = getResponseDataOrThrow<BundledNativeModuleList>(json);\n if (!data.length) {\n throw new CommandError('VERSIONS', 'The bundled native module list from the Expo API is empty');\n }\n return fromBundledNativeModuleList(data);\n}\n\nfunction fromBundledNativeModuleList(list: BundledNativeModuleList): BundledNativeModules {\n return list.reduce((acc, i) => {\n acc[i.npmPackage] = i.versionRange;\n return acc;\n }, {} as BundledNativeModules);\n}\n"],"names":["getNativeModuleVersionsAsync","sdkVersion","fetchAsync","createCachedFetch","cacheDirectory","ttl","response","ok","CommandError","statusText","json","data","getResponseDataOrThrow","length","fromBundledNativeModuleList","list","reduce","acc","i","npmPackage","versionRange"],"mappings":"AAAA;;;;+BA8BsBA,8BAA4B;;aAA5BA,4BAA4B;;wBA9BQ,eAAe;wBAC5C,iBAAiB;AA6BvC,eAAeA,4BAA4B,CAChDC,UAAkB,EACa;IAC/B,MAAMC,UAAU,GAAGC,IAAAA,OAAiB,kBAAA,EAAC;QACnCC,cAAc,EAAE,sBAAsB;QACtC,iBAAiB;QACjBC,GAAG,EAAE,IAAI,GAAG,EAAE;KACf,CAAC,AAAC;IACH,MAAMC,QAAQ,GAAG,MAAMJ,UAAU,CAAC,CAAC,KAAK,EAAED,UAAU,CAAC,eAAe,CAAC,CAAC,AAAC;IACvE,IAAI,CAACK,QAAQ,CAACC,EAAE,EAAE;QAChB,MAAM,IAAIC,OAAY,aAAA,CACpB,KAAK,EACL,CAAC,kEAAkE,EAAEF,QAAQ,CAACG,UAAU,CAAC,CAAC,CAAC,CAC5F,CAAC;IACJ,CAAC;IAED,MAAMC,IAAI,GAAG,MAAMJ,QAAQ,CAACI,IAAI,EAAE,AAAC;IACnC,MAAMC,IAAI,GAAGC,IAAAA,OAAsB,uBAAA,EAA0BF,IAAI,CAAC,AAAC;IACnE,IAAI,CAACC,IAAI,CAACE,MAAM,EAAE;QAChB,MAAM,IAAIL,OAAY,aAAA,CAAC,UAAU,EAAE,2DAA2D,CAAC,CAAC;IAClG,CAAC;IACD,OAAOM,2BAA2B,CAACH,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED,SAASG,2BAA2B,CAACC,IAA6B,EAAwB;IACxF,OAAOA,IAAI,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,CAAC,GAAK;QAC7BD,GAAG,CAACC,CAAC,CAACC,UAAU,CAAC,GAAGD,CAAC,CAACE,YAAY,CAAC;QACnC,OAAOH,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAyB,CAAC;AACjC,CAAC"}
@@ -19,6 +19,7 @@ const AppFragmentNode = (0, _core().gql)`
19
19
  scopeKey
20
20
  ownerAccount {
21
21
  id
22
+ name
22
23
  }
23
24
  }
24
25
  `;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/api/graphql/types/App.ts"],"sourcesContent":["import { TypedDocumentNode, gql } from '@urql/core';\n\nexport const AppFragmentNode: TypedDocumentNode = gql`\n fragment AppFragment on App {\n id\n scopeKey\n ownerAccount {\n id\n }\n }\n`;\n"],"names":["AppFragmentNode","gql"],"mappings":"AAAA;;;;+BAEaA,iBAAe;;aAAfA,eAAe;;;yBAFW,YAAY;;;;;;AAE5C,MAAMA,eAAe,GAAsBC,IAAAA,KAAG,EAAA,IAAA,CAAA,CAAC;;;;;;;;AAQtD,CAAC,AAAC"}
1
+ {"version":3,"sources":["../../../../../src/api/graphql/types/App.ts"],"sourcesContent":["import { TypedDocumentNode, gql } from '@urql/core';\n\nexport const AppFragmentNode: TypedDocumentNode = gql`\n fragment AppFragment on App {\n id\n scopeKey\n ownerAccount {\n id\n name\n }\n }\n`;\n"],"names":["AppFragmentNode","gql"],"mappings":"AAAA;;;;+BAEaA,iBAAe;;aAAfA,eAAe;;;yBAFW,YAAY;;;;;;AAE5C,MAAMA,eAAe,GAAsBC,IAAAA,KAAG,EAAA,IAAA,CAAA,CAAC;;;;;;;;;AAStD,CAAC,AAAC"}
@@ -6,58 +6,130 @@ Object.defineProperty(exports, "FileSystemResponseCache", {
6
6
  enumerable: true,
7
7
  get: ()=>FileSystemResponseCache
8
8
  });
9
- function _cacache() {
10
- const data = /*#__PURE__*/ _interopRequireDefault(require("cacache"));
11
- _cacache = function() {
9
+ function _nodeCrypto() {
10
+ const data = /*#__PURE__*/ _interopRequireDefault(require("node:crypto"));
11
+ _nodeCrypto = function() {
12
12
  return data;
13
13
  };
14
14
  return data;
15
15
  }
16
- function _stream() {
17
- const data = require("stream");
18
- _stream = function() {
16
+ function _nodeFs() {
17
+ const data = /*#__PURE__*/ _interopRequireDefault(require("node:fs"));
18
+ _nodeFs = function() {
19
19
  return data;
20
20
  };
21
21
  return data;
22
22
  }
23
+ function _nodePath() {
24
+ const data = /*#__PURE__*/ _interopRequireDefault(require("node:path"));
25
+ _nodePath = function() {
26
+ return data;
27
+ };
28
+ return data;
29
+ }
30
+ function _nodeStream() {
31
+ const data = /*#__PURE__*/ _interopRequireWildcard(require("node:stream"));
32
+ _nodeStream = function() {
33
+ return data;
34
+ };
35
+ return data;
36
+ }
37
+ const _dir = require("../../../utils/dir");
23
38
  function _interopRequireDefault(obj) {
24
39
  return obj && obj.__esModule ? obj : {
25
40
  default: obj
26
41
  };
27
42
  }
43
+ function _getRequireWildcardCache(nodeInterop) {
44
+ if (typeof WeakMap !== "function") return null;
45
+ var cacheBabelInterop = new WeakMap();
46
+ var cacheNodeInterop = new WeakMap();
47
+ return (_getRequireWildcardCache = function(nodeInterop) {
48
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
49
+ })(nodeInterop);
50
+ }
51
+ function _interopRequireWildcard(obj, nodeInterop) {
52
+ if (!nodeInterop && obj && obj.__esModule) {
53
+ return obj;
54
+ }
55
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
56
+ return {
57
+ default: obj
58
+ };
59
+ }
60
+ var cache = _getRequireWildcardCache(nodeInterop);
61
+ if (cache && cache.has(obj)) {
62
+ return cache.get(obj);
63
+ }
64
+ var newObj = {};
65
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
66
+ for(var key in obj){
67
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
68
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
69
+ if (desc && (desc.get || desc.set)) {
70
+ Object.defineProperty(newObj, key, desc);
71
+ } else {
72
+ newObj[key] = obj[key];
73
+ }
74
+ }
75
+ }
76
+ newObj.default = obj;
77
+ if (cache) {
78
+ cache.set(obj, newObj);
79
+ }
80
+ return newObj;
81
+ }
28
82
  class FileSystemResponseCache {
29
83
  constructor(options){
30
84
  this.cacheDirectory = options.cacheDirectory;
31
85
  this.timeToLive = options.ttl;
32
86
  }
87
+ getFilePaths(cacheKey) {
88
+ // Create a hash of the cache key to use as filename
89
+ const hash = _nodeCrypto().default.createHash("sha256").update(cacheKey).digest("hex");
90
+ return {
91
+ info: _nodePath().default.join(this.cacheDirectory, `${hash}-info.json`),
92
+ body: _nodePath().default.join(this.cacheDirectory, `${hash}-body.bin`)
93
+ };
94
+ }
33
95
  /** Retrieve the cache response, if any */ async get(cacheKey) {
34
- const responseInfoKey = getResponseInfoKey(cacheKey);
35
- const responseInfoMeta = await _cacache().default.get.info(this.cacheDirectory, responseInfoKey);
36
- // Abort if the response info is not found
37
- if (!responseInfoMeta) {
96
+ const paths = this.getFilePaths(cacheKey);
97
+ if (!await (0, _dir.fileExistsAsync)(paths.info)) {
38
98
  return undefined;
39
99
  }
40
- const responseInfoBuffer = await _cacache().default.get.byDigest(this.cacheDirectory, responseInfoMeta.integrity);
41
- const responseInfo = JSON.parse(responseInfoBuffer.toString());
42
- // Remove cache-specific data from the response info
43
- const { empty , expiration , bodyIntegrity } = responseInfo;
44
- delete responseInfo.empty;
45
- delete responseInfo.expiration;
46
- delete responseInfo.bodyIntegrity;
47
- // Invalidate the response if it has expired, or there is no known body integrity
48
- if (!bodyIntegrity || expiration && expiration < Date.now()) {
100
+ // Read and parse the info file
101
+ const infoBuffer = await _nodeFs().default.promises.readFile(paths.info);
102
+ try {
103
+ const responseInfo = JSON.parse(infoBuffer.toString());
104
+ // Check if the response has expired
105
+ if (responseInfo.expiration && responseInfo.expiration < Date.now()) {
106
+ await this.remove(cacheKey);
107
+ return undefined;
108
+ }
109
+ // Remove cache-specific data from the response info
110
+ const { empty , expiration , bodyPath , ...cleanInfo } = responseInfo;
111
+ // Create response body stream
112
+ let responseBody;
113
+ if (empty) {
114
+ responseBody = _nodeStream().Readable.toWeb(_nodeStream().Readable.from(Buffer.alloc(0)));
115
+ } else {
116
+ const bodyBuffer = await _nodeFs().default.promises.readFile(paths.body);
117
+ responseBody = _nodeStream().Readable.toWeb(_nodeStream().Readable.from(bodyBuffer));
118
+ }
119
+ return {
120
+ body: responseBody,
121
+ info: cleanInfo
122
+ };
123
+ } catch {
124
+ // If file doesn't exist or other errors, return undefined
49
125
  return undefined;
50
126
  }
51
- // Create a read-stream for the response body
52
- const responseBody = empty ? _stream().Readable.from(Buffer.alloc(0)) : _stream().Readable.from(_cacache().default.get.stream.byDigest(this.cacheDirectory, bodyIntegrity));
53
- return {
54
- body: _stream().Readable.toWeb(responseBody),
55
- info: responseInfo
56
- };
57
127
  }
58
128
  /** Store the response for caching */ async set(cacheKey, response) {
59
- const responseBodyKey = getResponseBodyKey(cacheKey);
60
- const responseInfoKey = getResponseInfoKey(cacheKey);
129
+ await _nodeFs().default.promises.mkdir(this.cacheDirectory, {
130
+ recursive: true
131
+ });
132
+ const paths = this.getFilePaths(cacheKey);
61
133
  // Create a copy of the response info, to add cache-specific data
62
134
  const responseInfo = {
63
135
  ...response.info
@@ -67,35 +139,42 @@ class FileSystemResponseCache {
67
139
  responseInfo.expiration = Date.now() + this.timeToLive;
68
140
  }
69
141
  try {
70
- // Store the response body as stream, and calculate the stream integrity
71
- responseInfo.bodyIntegrity = await new Promise((fulfill, reject)=>{
72
- _stream().Readable.fromWeb(response.body).pipe(_cacache().default.put.stream(this.cacheDirectory, responseBodyKey)).on("integrity", (integrity)=>fulfill(integrity)).once("error", reject);
73
- });
74
- } catch (error) {
75
- if (error.code !== "ENODATA") {
76
- throw error;
142
+ // Clone the response body stream since we need to read it twice
143
+ const [forSize, forWrite] = response.body.tee();
144
+ // Check if the body is empty by reading the first stream
145
+ const reader = forSize.getReader();
146
+ const { value } = await reader.read();
147
+ reader.releaseLock();
148
+ if (!value || value.length === 0) {
149
+ responseInfo.empty = true;
150
+ } else {
151
+ // Create write stream and pipe response body to file
152
+ const writeStream = _nodeFs().default.createWriteStream(paths.body);
153
+ const nodeStream = _nodeStream().Readable.fromWeb(forWrite);
154
+ nodeStream.pipe(writeStream);
155
+ // Wait for the stream to finish
156
+ await _nodeStream().default.promises.finished(writeStream);
157
+ responseInfo.bodyPath = paths.body;
77
158
  }
78
- // Mark the response as empty
79
- responseInfo.empty = true;
80
- responseInfo.bodyIntegrity = undefined;
159
+ // Write info to file
160
+ await _nodeFs().default.promises.writeFile(paths.info, JSON.stringify(responseInfo));
161
+ return await this.get(cacheKey);
162
+ } catch (error) {
163
+ // Clean up any partially written files
164
+ await this.remove(cacheKey);
165
+ throw error;
81
166
  }
82
- // Store the response info
83
- const responseInfoBuffer = Buffer.from(JSON.stringify(responseInfo));
84
- await _cacache().default.put(this.cacheDirectory, responseInfoKey, responseInfoBuffer);
85
- return await this.get(cacheKey);
86
167
  }
87
168
  /** Remove the response from caching */ async remove(cacheKey) {
88
- await Promise.all([
89
- _cacache().default.rm.entry(this.cacheDirectory, getResponseBodyKey(cacheKey)),
90
- _cacache().default.rm.entry(this.cacheDirectory, getResponseBodyKey(cacheKey)),
91
- ]);
169
+ const paths = this.getFilePaths(cacheKey);
170
+ await removeAllAsync(paths.info, paths.body);
92
171
  }
93
172
  }
94
- function getResponseBodyKey(cacheKey) {
95
- return `${cacheKey}UndiciBody`;
96
- }
97
- function getResponseInfoKey(cacheKey) {
98
- return `${cacheKey}UndiciInfo`;
173
+ function removeAllAsync(...paths) {
174
+ return Promise.all(paths.map((path)=>_nodeFs().default.promises.rm(path, {
175
+ recursive: true,
176
+ force: true
177
+ }).catch(()=>{})));
99
178
  }
100
179
 
101
180
  //# sourceMappingURL=FileSystemResponseCache.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/api/rest/cache/FileSystemResponseCache.ts"],"sourcesContent":["import cacache from 'cacache';\nimport { Readable } from 'stream';\n\nimport type { ResponseCache, ResponseCacheEntry } from './ResponseCache';\n\ntype FileSystemResponseCacheInfo = ResponseCacheEntry['info'] & {\n /** Stream integrity used to validate the local body response */\n bodyIntegrity?: string;\n /** If there is no response body */\n empty?: boolean;\n /** The expiration time, in seconds, when the response should be invalidated */\n expiration?: number;\n};\n\nexport class FileSystemResponseCache implements ResponseCache {\n /** The absolute path to the directory used to store responses */\n private cacheDirectory: string;\n /** Optional auto-expiration for all stored response */\n private timeToLive?: number;\n\n constructor(options: { cacheDirectory: string; ttl?: number }) {\n this.cacheDirectory = options.cacheDirectory;\n this.timeToLive = options.ttl;\n }\n\n /** Retrieve the cache response, if any */\n async get(cacheKey: string): Promise<ResponseCacheEntry | undefined> {\n const responseInfoKey = getResponseInfoKey(cacheKey);\n const responseInfoMeta = await cacache.get.info(this.cacheDirectory, responseInfoKey);\n\n // Abort if the response info is not found\n if (!responseInfoMeta) {\n return undefined;\n }\n\n const responseInfoBuffer = await cacache.get.byDigest(\n this.cacheDirectory,\n responseInfoMeta.integrity\n );\n const responseInfo: FileSystemResponseCacheInfo = JSON.parse(responseInfoBuffer.toString());\n\n // Remove cache-specific data from the response info\n const { empty, expiration, bodyIntegrity } = responseInfo;\n delete responseInfo.empty;\n delete responseInfo.expiration;\n delete responseInfo.bodyIntegrity;\n\n // Invalidate the response if it has expired, or there is no known body integrity\n if (!bodyIntegrity || (expiration && expiration < Date.now())) {\n return undefined;\n }\n\n // Create a read-stream for the response body\n const responseBody = empty\n ? Readable.from(Buffer.alloc(0))\n : Readable.from(cacache.get.stream.byDigest(this.cacheDirectory, bodyIntegrity));\n\n return {\n body: Readable.toWeb(responseBody),\n info: responseInfo,\n };\n }\n\n /** Store the response for caching */\n async set(\n cacheKey: string,\n response: ResponseCacheEntry\n ): Promise<ResponseCacheEntry | undefined> {\n const responseBodyKey = getResponseBodyKey(cacheKey);\n const responseInfoKey = getResponseInfoKey(cacheKey);\n\n // Create a copy of the response info, to add cache-specific data\n const responseInfo: FileSystemResponseCacheInfo = { ...response.info };\n\n // Add expiration time if the \"time to live\" is set\n if (typeof this.timeToLive === 'number') {\n responseInfo.expiration = Date.now() + this.timeToLive;\n }\n\n try {\n // Store the response body as stream, and calculate the stream integrity\n responseInfo.bodyIntegrity = await new Promise((fulfill, reject) => {\n Readable.fromWeb(response.body)\n .pipe(cacache.put.stream(this.cacheDirectory, responseBodyKey))\n .on('integrity', (integrity) => fulfill(integrity))\n .once('error', reject);\n });\n } catch (error: any) {\n if (error.code !== 'ENODATA') {\n throw error;\n }\n\n // Mark the response as empty\n responseInfo.empty = true;\n responseInfo.bodyIntegrity = undefined;\n }\n\n // Store the response info\n const responseInfoBuffer = Buffer.from(JSON.stringify(responseInfo));\n await cacache.put(this.cacheDirectory, responseInfoKey, responseInfoBuffer);\n\n return await this.get(cacheKey);\n }\n\n /** Remove the response from caching */\n async remove(cacheKey: string): Promise<void> {\n await Promise.all([\n cacache.rm.entry(this.cacheDirectory, getResponseBodyKey(cacheKey)),\n cacache.rm.entry(this.cacheDirectory, getResponseBodyKey(cacheKey)),\n ]);\n }\n}\n\nfunction getResponseBodyKey(cacheKey: string) {\n return `${cacheKey}UndiciBody`;\n}\n\nfunction getResponseInfoKey(cacheKey: string) {\n return `${cacheKey}UndiciInfo`;\n}\n"],"names":["FileSystemResponseCache","constructor","options","cacheDirectory","timeToLive","ttl","get","cacheKey","responseInfoKey","getResponseInfoKey","responseInfoMeta","cacache","info","undefined","responseInfoBuffer","byDigest","integrity","responseInfo","JSON","parse","toString","empty","expiration","bodyIntegrity","Date","now","responseBody","Readable","from","Buffer","alloc","stream","body","toWeb","set","response","responseBodyKey","getResponseBodyKey","Promise","fulfill","reject","fromWeb","pipe","put","on","once","error","code","stringify","remove","all","rm","entry"],"mappings":"AAAA;;;;+BAcaA,yBAAuB;;aAAvBA,uBAAuB;;;8DAdhB,SAAS;;;;;;;yBACJ,QAAQ;;;;;;;;;;;AAa1B,MAAMA,uBAAuB;IAMlCC,YAAYC,OAAiD,CAAE;QAC7D,IAAI,CAACC,cAAc,GAAGD,OAAO,CAACC,cAAc,CAAC;QAC7C,IAAI,CAACC,UAAU,GAAGF,OAAO,CAACG,GAAG,CAAC;IAChC;IAEA,wCAAwC,SAClCC,GAAG,CAACC,QAAgB,EAA2C;QACnE,MAAMC,eAAe,GAAGC,kBAAkB,CAACF,QAAQ,CAAC,AAAC;QACrD,MAAMG,gBAAgB,GAAG,MAAMC,QAAO,EAAA,QAAA,CAACL,GAAG,CAACM,IAAI,CAAC,IAAI,CAACT,cAAc,EAAEK,eAAe,CAAC,AAAC;QAEtF,0CAA0C;QAC1C,IAAI,CAACE,gBAAgB,EAAE;YACrB,OAAOG,SAAS,CAAC;QACnB,CAAC;QAED,MAAMC,kBAAkB,GAAG,MAAMH,QAAO,EAAA,QAAA,CAACL,GAAG,CAACS,QAAQ,CACnD,IAAI,CAACZ,cAAc,EACnBO,gBAAgB,CAACM,SAAS,CAC3B,AAAC;QACF,MAAMC,YAAY,GAAgCC,IAAI,CAACC,KAAK,CAACL,kBAAkB,CAACM,QAAQ,EAAE,CAAC,AAAC;QAE5F,oDAAoD;QACpD,MAAM,EAAEC,KAAK,CAAA,EAAEC,UAAU,CAAA,EAAEC,aAAa,CAAA,EAAE,GAAGN,YAAY,AAAC;QAC1D,OAAOA,YAAY,CAACI,KAAK,CAAC;QAC1B,OAAOJ,YAAY,CAACK,UAAU,CAAC;QAC/B,OAAOL,YAAY,CAACM,aAAa,CAAC;QAElC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U,CAAC,CAAC;AACjC,CAAC;AAED,SAASE,kBAAkB,CAACF,QAAgB,EAAE;IAC5C,OAAO,CAAC,EAAEA,QAAQ,CAAC,UAAU,CAAC,CAAC;AACjC,CAAC"}
1
+ {"version":3,"sources":["../../../../../src/api/rest/cache/FileSystemResponseCache.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport stream, { Readable } from 'node:stream';\nimport { ReadableStream } from 'node:stream/web';\n\nimport type { ResponseCache, ResponseCacheEntry } from './ResponseCache';\nimport { fileExistsAsync } from '../../../utils/dir';\n\ntype FileSystemResponseCacheInfo = ResponseCacheEntry['info'] & {\n /** The path to the cached body file */\n bodyPath?: string;\n /** If there is no response body */\n empty?: boolean;\n /** The expiration time, in milliseconds, when the response should be invalidated */\n expiration?: number;\n};\n\nexport class FileSystemResponseCache implements ResponseCache {\n /** The absolute path to the directory used to store responses */\n private cacheDirectory: string;\n /** Optional auto-expiration for all stored responses */\n private timeToLive?: number;\n\n constructor(options: { cacheDirectory: string; ttl?: number }) {\n this.cacheDirectory = options.cacheDirectory;\n this.timeToLive = options.ttl;\n }\n\n private getFilePaths(cacheKey: string) {\n // Create a hash of the cache key to use as filename\n const hash = crypto.createHash('sha256').update(cacheKey).digest('hex');\n return {\n info: path.join(this.cacheDirectory, `${hash}-info.json`),\n body: path.join(this.cacheDirectory, `${hash}-body.bin`),\n };\n }\n\n /** Retrieve the cache response, if any */\n async get(cacheKey: string): Promise<ResponseCacheEntry | undefined> {\n const paths = this.getFilePaths(cacheKey);\n\n if (!(await fileExistsAsync(paths.info))) {\n return undefined;\n }\n\n // Read and parse the info file\n const infoBuffer = await fs.promises.readFile(paths.info);\n\n try {\n const responseInfo: FileSystemResponseCacheInfo = JSON.parse(infoBuffer.toString());\n\n // Check if the response has expired\n if (responseInfo.expiration && responseInfo.expiration < Date.now()) {\n await this.remove(cacheKey);\n return undefined;\n }\n\n // Remove cache-specific data from the response info\n const { empty, expiration, bodyPath, ...cleanInfo } = responseInfo;\n\n // Create response body stream\n let responseBody: ReadableStream;\n if (empty) {\n responseBody = Readable.toWeb(Readable.from(Buffer.alloc(0)));\n } else {\n const bodyBuffer = await fs.promises.readFile(paths.body);\n responseBody = Readable.toWeb(Readable.from(bodyBuffer));\n }\n\n return {\n body: responseBody,\n info: cleanInfo,\n };\n } catch {\n // If file doesn't exist or other errors, return undefined\n return undefined;\n }\n }\n\n /** Store the response for caching */\n async set(\n cacheKey: string,\n response: ResponseCacheEntry\n ): Promise<ResponseCacheEntry | undefined> {\n await fs.promises.mkdir(this.cacheDirectory, { recursive: true });\n const paths = this.getFilePaths(cacheKey);\n\n // Create a copy of the response info, to add cache-specific data\n const responseInfo: FileSystemResponseCacheInfo = { ...response.info };\n\n // Add expiration time if the \"time to live\" is set\n if (typeof this.timeToLive === 'number') {\n responseInfo.expiration = Date.now() + this.timeToLive;\n }\n\n try {\n // Clone the response body stream since we need to read it twice\n const [forSize, forWrite] = response.body.tee();\n\n // Check if the body is empty by reading the first stream\n const reader = forSize.getReader();\n const { value } = await reader.read();\n reader.releaseLock();\n\n if (!value || value.length === 0) {\n responseInfo.empty = true;\n } else {\n // Create write stream and pipe response body to file\n const writeStream = fs.createWriteStream(paths.body);\n const nodeStream = Readable.fromWeb(forWrite);\n nodeStream.pipe(writeStream);\n\n // Wait for the stream to finish\n await stream.promises.finished(writeStream);\n\n responseInfo.bodyPath = paths.body;\n }\n\n // Write info to file\n await fs.promises.writeFile(paths.info, JSON.stringify(responseInfo));\n\n return await this.get(cacheKey);\n } catch (error) {\n // Clean up any partially written files\n await this.remove(cacheKey);\n throw error;\n }\n }\n\n /** Remove the response from caching */\n async remove(cacheKey: string): Promise<void> {\n const paths = this.getFilePaths(cacheKey);\n await removeAllAsync(paths.info, paths.body);\n }\n}\n\nfunction removeAllAsync(...paths: string[]) {\n return Promise.all(\n paths.map((path) => fs.promises.rm(path, { recursive: true, force: true }).catch(() => {}))\n );\n}\n"],"names":["FileSystemResponseCache","constructor","options","cacheDirectory","timeToLive","ttl","getFilePaths","cacheKey","hash","crypto","createHash","update","digest","info","path","join","body","get","paths","fileExistsAsync","undefined","infoBuffer","fs","promises","readFile","responseInfo","JSON","parse","toString","expiration","Date","now","remove","empty","bodyPath","cleanInfo","responseBody","Readable","toWeb","from","Buffer","alloc","bodyBuffer","set","response","mkdir","recursive","forSize","forWrite","tee","reader","getReader","value","read","releaseLock","length","writeStream","createWriteStream","nodeStream","fromWeb","pipe","stream","finished","writeFile","stringify","error","removeAllAsync","Promise","all","map","rm","force","catch"],"mappings":"AAAA;;;;+BAkBaA,yBAAuB;;aAAvBA,uBAAuB;;;8DAlBjB,aAAa;;;;;;;8DACjB,SAAS;;;;;;;8DACP,WAAW;;;;;;;+DACK,aAAa;;;;;;qBAId,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAW7C,MAAMA,uBAAuB;IAMlCC,YAAYC,OAAiD,CAAE;QAC7D,IAAI,CAACC,cAAc,GAAGD,OAAO,CAACC,cAAc,CAAC;QAC7C,IAAI,CAACC,UAAU,GAAGF,OAAO,CAACG,GAAG,CAAC;IAChC;IAEQC,YAAY,CAACC,QAAgB,EAAE;QACrC,oDAAoD;QACpD,MAAMC,IAAI,GAAGC,WAAM,EAAA,QAAA,CAACC,UAAU,CAAC,QAAQ,CAAC,CAACC,MAAM,CAACJ,QAAQ,CAAC,CAACK,MAAM,CAAC,KAAK,CAAC,AAAC;QACxE,OAAO;YACLC,IAAI,EAAEC,SAAI,EAAA,QAAA,CAACC,IAAI,CAAC,IAAI,CAACZ,cAAc,EAAE,CAAC,EAAEK,IAAI,CAAC,UAAU,CAAC,CAAC;YACzDQ,IAAI,EAAEF,SAAI,EAAA,QAAA,CAACC,IAAI,CAAC,IAAI,CAACZ,cAAc,EAAE,CAAC,EAAEK,IAAI,CAAC,SAAS,CAAC,CAAC;SACzD,CAAC;IACJ;IAEA,wCAAwC,SAClCS,GAAG,CAACV,Q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