@ms-cloudpack/bundler-ori 0.2.23 → 0.2.25

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.
@@ -1 +1 @@
1
- {"version":3,"file":"buildWithRetries.d.ts","sourceRoot":"","sources":["../src/buildWithRetries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAS,KAAK,WAAW,IAAI,cAAc,EAAE,MAAM,UAAU,CAAC;AAuBrE;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,2BAA2B;IAC3B,QAAQ,EAAE,eAAe,CAAC;IAC1B,0GAA0G;IAC1G,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,cAAc,CAAC,CAoC1B"}
1
+ {"version":3,"file":"buildWithRetries.d.ts","sourceRoot":"","sources":["../src/buildWithRetries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAS,KAAK,WAAW,IAAI,cAAc,EAAE,MAAM,UAAU,CAAC;AAwBrE;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,2BAA2B;IAC3B,QAAQ,EAAE,eAAe,CAAC;IAC1B,0GAA0G;IAC1G,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,cAAc,CAAC,CAoC1B"}
@@ -11,7 +11,8 @@ const intermittentErrorRetryPolicy = {
11
11
  handle: (error) => error instanceof Error &&
12
12
  (error.message.includes('room is closed') ||
13
13
  error.message.includes('failed marshalling message') ||
14
- error.message.includes('ori api-service')),
14
+ error.message.includes('ori api-service') ||
15
+ error.message.includes('Connection closed')),
15
16
  };
16
17
  /** Retry 1 time (2 in total) if a timeout error was thrown by ori */
17
18
  const timeoutRetryPolicy = {
@@ -1 +1 @@
1
- {"version":3,"file":"buildWithRetries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ACf,UAAU,GAAG,IAAI,CAAC;QACpB,CAAC;aAAM,IAAI,YAAY,CAAC,MAAM,KAAK,4BAA4B,EAAE,CAAC;YAChE,OAAO,CAAC,IAAI,CACV,4BAA4B,SAAS,WAAW,YAAY,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,CAAC,UAAU,IAAI;gBAC7G,mCAAoC,YAAY,CAAC,SAAmB,CAAC,OAAO,EAAE,CACjF,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,EAAE,GAAG,QAAQ,EAAE,yBAAyB,EAAE,SAAS,EAAE,CAAC,CAAC;QAElF,IAAI,UAAU,EAAE,CAAC;YACf,wFAAwF;YACxF,kFAAkF;YAClF,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACnB,IAAI,EACF,wDAAwD,SAAS,MAAM;oBACvE,2GAA2G,SAAS,SAAS;oBAC7H,gEAAgE;aAClB,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { RetryManager, type RetryPolicy } from '@ms-cloudpack/retry';\nimport type { OriBuildOptions } from './getOriOptions.js';\nimport { build, type BuildResult as OriBuildResult } from 'oribuild';\n\n/**\n * Retry 2 times (3 in total) if the error message contains\n * 'room is closed', 'failed marshalling message' or 'ori api-service'.\n * The first two are intermittent errors which may be caused by race conditions.\n * The last one is a known error message from the ori API service.\n */\nconst intermittentErrorRetryPolicy: RetryPolicy = {\n maxRetries: 2,\n handle: (error) =>\n error instanceof Error &&\n (error.message.includes('room is closed') ||\n error.message.includes('failed marshalling message') ||\n error.message.includes('ori api-service')),\n};\n\n/** Retry 1 time (2 in total) if a timeout error was thrown by ori */\nconst timeoutRetryPolicy: RetryPolicy = {\n maxRetries: 1,\n handle: (error) => error instanceof Error && error.message.includes('within the timeout window'),\n};\n\n/**\n * Call ori `build()` with retries. This is a separate function for testing of retry logic.\n */\nexport function buildWithRetries(params: {\n /** Params passed to ori */\n oriInput: OriBuildOptions;\n /** Just used to identify the bundled package in log messages (ori options don't contain this raw path) */\n inputPath: string;\n}): Promise<OriBuildResult> {\n const { oriInput, inputPath } = params;\n const retryManager = new RetryManager([intermittentErrorRetryPolicy, timeoutRetryPolicy]);\n\n let timeoutMs = oriInput.buildAcknowledgeTimeoutMs;\n let hadTimeout = false;\n\n return retryManager.retry(async (retryContext) => {\n if (retryContext.policy === timeoutRetryPolicy) {\n console.warn(\n `ori build for ${inputPath} timed out after ${timeoutMs}ms. Will retry with ${timeoutMs * 2}ms timeout.`,\n );\n timeoutMs *= 2;\n hadTimeout = true;\n } else if (retryContext.policy === intermittentErrorRetryPolicy) {\n console.warn(\n `Will retry ori build for ${inputPath} (retry ${retryContext.retryAttempt}/${retryContext.policy.maxRetries}) ` +\n `after known intermittent error: ${(retryContext.lastError as Error).message}`,\n );\n }\n\n const result = await build({ ...oriInput, buildAcknowledgeTimeoutMs: timeoutMs });\n\n if (hadTimeout) {\n // Include a warning in the output recommending increasing the timeout for this package.\n // The warning is more visible this way than if it was only logged to the console.\n result.warnings.push({\n text:\n `Build succeeded on retry after increasing timeout to ${timeoutMs}ms. ` +\n `You may want to add cloudpack packageSettings with \\`{ \"bundlerOptions\": { \"buildAcknowledgeTimeoutMs\": ${timeoutMs} } }\\` ` +\n 'to use a longer timeout for this package on the first attempt.',\n } as unknown as OriBuildResult['warnings'][number]);\n }\n\n return result;\n });\n}\n"]}
1
+ {"version":3,"file":"buildWithRetries.js","sourceRoot":"","sources":["../src/buildWithRetries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoB,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,KAAK,EAAsC,MAAM,UAAU,CAAC;AAErE;;;;;GAKG;AACH,MAAM,4BAA4B,GAAgB;IAChD,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAChB,KAAK,YAAY,KAAK;QACtB,CAAC,KAAK,CA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OAAO,EAAE,CACjF,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,EAAE,GAAG,QAAQ,EAAE,yBAAyB,EAAE,SAAS,EAAE,CAAC,CAAC;QAElF,IAAI,UAAU,EAAE,CAAC;YACf,wFAAwF;YACxF,kFAAkF;YAClF,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACnB,IAAI,EACF,wDAAwD,SAAS,MAAM;oBACvE,2GAA2G,SAAS,SAAS;oBAC7H,gEAAgE;aAClB,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { RetryManager, type RetryPolicy } from '@ms-cloudpack/retry';\nimport type { OriBuildOptions } from './getOriOptions.js';\nimport { build, type BuildResult as OriBuildResult } from 'oribuild';\n\n/**\n * Retry 2 times (3 in total) if the error message contains\n * 'room is closed', 'failed marshalling message' or 'ori api-service'.\n * The first two are intermittent errors which may be caused by race conditions.\n * The last one is a known error message from the ori API service.\n */\nconst intermittentErrorRetryPolicy: RetryPolicy = {\n maxRetries: 2,\n handle: (error) =>\n error instanceof Error &&\n (error.message.includes('room is closed') ||\n error.message.includes('failed marshalling message') ||\n error.message.includes('ori api-service') ||\n error.message.includes('Connection closed')),\n};\n\n/** Retry 1 time (2 in total) if a timeout error was thrown by ori */\nconst timeoutRetryPolicy: RetryPolicy = {\n maxRetries: 1,\n handle: (error) => error instanceof Error && error.message.includes('within the timeout window'),\n};\n\n/**\n * Call ori `build()` with retries. This is a separate function for testing of retry logic.\n */\nexport function buildWithRetries(params: {\n /** Params passed to ori */\n oriInput: OriBuildOptions;\n /** Just used to identify the bundled package in log messages (ori options don't contain this raw path) */\n inputPath: string;\n}): Promise<OriBuildResult> {\n const { oriInput, inputPath } = params;\n const retryManager = new RetryManager([intermittentErrorRetryPolicy, timeoutRetryPolicy]);\n\n let timeoutMs = oriInput.buildAcknowledgeTimeoutMs;\n let hadTimeout = false;\n\n return retryManager.retry(async (retryContext) => {\n if (retryContext.policy === timeoutRetryPolicy) {\n console.warn(\n `ori build for ${inputPath} timed out after ${timeoutMs}ms. Will retry with ${timeoutMs * 2}ms timeout.`,\n );\n timeoutMs *= 2;\n hadTimeout = true;\n } else if (retryContext.policy === intermittentErrorRetryPolicy) {\n console.warn(\n `Will retry ori build for ${inputPath} (retry ${retryContext.retryAttempt}/${retryContext.policy.maxRetries}) ` +\n `after known intermittent error: ${(retryContext.lastError as Error).message}`,\n );\n }\n\n const result = await build({ ...oriInput, buildAcknowledgeTimeoutMs: timeoutMs });\n\n if (hadTimeout) {\n // Include a warning in the output recommending increasing the timeout for this package.\n // The warning is more visible this way than if it was only logged to the console.\n result.warnings.push({\n text:\n `Build succeeded on retry after increasing timeout to ${timeoutMs}ms. ` +\n `You may want to add cloudpack packageSettings with \\`{ \"bundlerOptions\": { \"buildAcknowledgeTimeoutMs\": ${timeoutMs} } }\\` ` +\n 'to use a longer timeout for this package on the first attempt.',\n } as unknown as OriBuildResult['warnings'][number]);\n }\n\n return result;\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/bundler-ori",
3
- "version": "0.2.23",
3
+ "version": "0.2.25",
4
4
  "description": "An abstraction to bundle source code using ori.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,10 +15,10 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@ms-cloudpack/bundler-capabilities": "^0.2.15",
18
- "@ms-cloudpack/bundler-utilities": "^0.2.4",
18
+ "@ms-cloudpack/bundler-utilities": "^0.2.5",
19
19
  "@ms-cloudpack/common-types": "^0.24.10",
20
20
  "@ms-cloudpack/json-utilities": "^0.1.10",
21
- "@ms-cloudpack/package-utilities": "^12.0.0",
21
+ "@ms-cloudpack/package-utilities": "^12.0.1",
22
22
  "@ms-cloudpack/path-string-parsing": "^1.2.6",
23
23
  "@ms-cloudpack/path-utilities": "^3.0.7",
24
24
  "@ms-cloudpack/retry": "^0.1.3",