@aws-sdk/util-arn-parser 3.873.0 → 3.953.0

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 (2) hide show
  1. package/dist-cjs/index.js +24 -61
  2. package/package.json +3 -2
package/dist-cjs/index.js CHANGED
@@ -1,64 +1,27 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
1
+ 'use strict';
2
+
3
+ const validate = (str) => typeof str === "string" && str.indexOf("arn:") === 0 && str.split(":").length >= 6;
4
+ const parse = (arn) => {
5
+ const segments = arn.split(":");
6
+ if (segments.length < 6 || segments[0] !== "arn")
7
+ throw new Error("Malformed ARN");
8
+ const [, partition, service, region, accountId, ...resource] = segments;
9
+ return {
10
+ partition,
11
+ service,
12
+ region,
13
+ accountId,
14
+ resource: resource.join(":"),
15
+ };
10
16
  };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
17
+ const build = (arnObject) => {
18
+ const { partition = "aws", service, region, accountId, resource } = arnObject;
19
+ if ([service, region, accountId, resource].some((segment) => typeof segment !== "string")) {
20
+ throw new Error("Input ARN object is invalid");
21
+ }
22
+ return `arn:${partition}:${service}:${region}:${accountId}:${resource}`;
18
23
  };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/index.ts
22
- var index_exports = {};
23
- __export(index_exports, {
24
- build: () => build,
25
- parse: () => parse,
26
- validate: () => validate
27
- });
28
- module.exports = __toCommonJS(index_exports);
29
- var validate = /* @__PURE__ */ __name((str) => typeof str === "string" && str.indexOf("arn:") === 0 && str.split(":").length >= 6, "validate");
30
- var parse = /* @__PURE__ */ __name((arn) => {
31
- const segments = arn.split(":");
32
- if (segments.length < 6 || segments[0] !== "arn") throw new Error("Malformed ARN");
33
- const [
34
- ,
35
- //Skip "arn" literal
36
- partition,
37
- service,
38
- region,
39
- accountId,
40
- ...resource
41
- ] = segments;
42
- return {
43
- partition,
44
- service,
45
- region,
46
- accountId,
47
- resource: resource.join(":")
48
- };
49
- }, "parse");
50
- var build = /* @__PURE__ */ __name((arnObject) => {
51
- const { partition = "aws", service, region, accountId, resource } = arnObject;
52
- if ([service, region, accountId, resource].some((segment) => typeof segment !== "string")) {
53
- throw new Error("Input ARN object is invalid");
54
- }
55
- return `arn:${partition}:${service}:${region}:${accountId}:${resource}`;
56
- }, "build");
57
- // Annotate the CommonJS export names for ESM import in node:
58
-
59
- 0 && (module.exports = {
60
- validate,
61
- parse,
62
- build
63
- });
64
24
 
25
+ exports.build = build;
26
+ exports.parse = parse;
27
+ exports.validate = validate;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@aws-sdk/util-arn-parser",
3
- "version": "3.873.0",
3
+ "version": "3.953.0",
4
4
  "description": "A parser to Amazon Resource Names",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
7
7
  "scripts": {
8
- "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
8
+ "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
9
9
  "build:cjs": "node ../../scripts/compilation/inline util-arn-parser",
10
10
  "build:es": "tsc -p tsconfig.es.json",
11
11
  "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
@@ -15,6 +15,7 @@
15
15
  "test": "yarn g:vitest run",
16
16
  "test:watch": "yarn g:vitest watch"
17
17
  },
18
+ "sideEffects": false,
18
19
  "author": {
19
20
  "name": "AWS SDK for JavaScript Team",
20
21
  "url": "https://aws.amazon.com/javascript/"