@kensio/yulin 0.1.0 → 0.1.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.
Files changed (57) hide show
  1. package/dist/service/cloudfront/factory/cloudfront-functions.factory.d.ts +4 -4
  2. package/dist/service/cloudfront/factory/cloudfront-functions.factory.d.ts.map +1 -1
  3. package/dist/service/cloudfront/factory/cloudfront-functions.factory.js +27 -6
  4. package/dist/service/cloudfront/factory/cloudfront-functions.factory.js.map +1 -1
  5. package/dist/service/cloudfront/index.d.ts +1 -1
  6. package/dist/service/cloudfront/index.d.ts.map +1 -1
  7. package/dist/service/cloudfront/index.js +1 -1
  8. package/dist/service/cloudfront/index.js.map +1 -1
  9. package/package.json +7 -1
  10. package/.github/workflows/pr.yml +0 -54
  11. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  12. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  13. package/.idea/jsLinters/eslint.xml +0 -6
  14. package/.idea/modules.xml +0 -8
  15. package/.idea/prettier.xml +0 -7
  16. package/.idea/vcs.xml +0 -6
  17. package/.idea/yulin.iml +0 -8
  18. package/.nvmrc +0 -1
  19. package/.prettierrc +0 -4
  20. package/eslint.config.ts +0 -222
  21. package/pnpm-workspace.yaml +0 -23
  22. package/scripts/publish.sh +0 -14
  23. package/src/command/command-handler.ts +0 -3
  24. package/src/index.ts +0 -0
  25. package/src/service/cloudfront/factory/cloudfront-functions.factory.iso.test.ts +0 -10
  26. package/src/service/cloudfront/factory/cloudfront-functions.factory.ts +0 -34
  27. package/src/service/cloudfront/index.ts +0 -13
  28. package/src/service/cloudfront/typings/cloudfront-functions.ts +0 -48
  29. package/src/service/dynamodb/command/create-table/create-table.handler.ts +0 -61
  30. package/src/service/dynamodb/command/create-table/create-table.iso.test.ts +0 -99
  31. package/src/service/dynamodb/command/describe-table/describe-table.handler.ts +0 -52
  32. package/src/service/dynamodb/command/describe-table/describe-table.iso.test.ts +0 -82
  33. package/src/service/dynamodb/command/list-tables/list-tables.handler.ts +0 -53
  34. package/src/service/dynamodb/command/list-tables/list-tables.iso.test.ts +0 -119
  35. package/src/service/dynamodb/command/put-item/put-item.handler.ts +0 -56
  36. package/src/service/dynamodb/command/put-item/put-item.iso.test.ts +0 -354
  37. package/src/service/dynamodb/dynamodb.ts +0 -60
  38. package/src/service/dynamodb/index.ts +0 -0
  39. package/src/service/dynamodb/item/dynamodb-item-attribute.iso.test.ts +0 -19
  40. package/src/service/dynamodb/item/dynamodb-item-attribute.ts +0 -116
  41. package/src/service/dynamodb/item/dynamodb-item.ts +0 -39
  42. package/src/service/dynamodb/table/dynamodb-key-schema.ts +0 -94
  43. package/src/service/dynamodb/table/dynamodb-table.iso.test.ts +0 -46
  44. package/src/service/dynamodb/table/dynamodb-table.ts +0 -75
  45. package/src/service/organizations/index.ts +0 -0
  46. package/src/service/organizations/sim-aws-account.ts +0 -36
  47. package/src/service/s3/index.ts +0 -1
  48. package/src/util/background/background.iso.test.ts +0 -74
  49. package/src/util/background/background.ts +0 -62
  50. package/src/util/brand.type.ts +0 -11
  51. package/src/util/defined.ts +0 -15
  52. package/src/util/memo/memo.iso.test.ts +0 -43
  53. package/src/util/memo/memo.ts +0 -26
  54. package/src/util/sleep.ts +0 -16
  55. package/tsconfig.build.json +0 -13
  56. package/tsconfig.json +0 -39
  57. package/vitest.config.ts +0 -50
@@ -1,7 +1,7 @@
1
- import type { CloudFrontRequest } from "../typings/cloudfront-functions.js";
2
- import { StaticFactory } from "@kensio/part-factory";
1
+ import type { CloudFrontEvent } from "../typings/cloudfront-functions.js";
2
+ import { VariantFactory } from "@kensio/part-factory";
3
3
  /**
4
- * Makes instances of the CloudFrontRequest object structure.
4
+ * Makes instances of the viewer-request CloudFrontEvent objects.
5
5
  */
6
- export declare const cloudFrontRequestFactory: StaticFactory<CloudFrontRequest>;
6
+ export declare const cloudFrontViewerRequestEventFactory: VariantFactory<CloudFrontEvent>;
7
7
  //# sourceMappingURL=cloudfront-functions.factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloudfront-functions.factory.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/factory/cloudfront-functions.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,wBAAwB,kCA2BnC,CAAC"}
1
+ {"version":3,"file":"cloudfront-functions.factory.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/factory/cloudfront-functions.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAkB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAkBtE;;GAEG;AACH,eAAO,MAAM,mCAAmC,iCAG5C,CAAC"}
@@ -1,11 +1,32 @@
1
- import { StaticFactory } from "@kensio/part-factory";
1
+ import { DynamicFactory, VariantFactory } from "@kensio/part-factory";
2
+ import { faker } from "@faker-js/faker";
3
+ /**
4
+ * Makes instances of the CloudFrontEvent object structure.
5
+ */
6
+ const cloudFrontEventFactory = new DynamicFactory(() => ({
7
+ context: {
8
+ eventType: faker.helpers.arrayElement([
9
+ "viewer-request",
10
+ "viewer-response",
11
+ ]),
12
+ requestId: faker.string.uuid(),
13
+ },
14
+ request: cloudFrontRequestFactory.make(),
15
+ viewer: { ip: faker.internet.ipv4() },
16
+ }));
17
+ /**
18
+ * Makes instances of the viewer-request CloudFrontEvent objects.
19
+ */
20
+ export const cloudFrontViewerRequestEventFactory = new VariantFactory(cloudFrontEventFactory, {
21
+ context: { eventType: "viewer-request" },
22
+ });
2
23
  /**
3
24
  * Makes instances of the CloudFrontRequest object structure.
4
25
  */
5
- export const cloudFrontRequestFactory = new StaticFactory({
26
+ const cloudFrontRequestFactory = new DynamicFactory(() => ({
6
27
  cookies: {
7
28
  sessionId: {
8
- value: "test-session-id",
29
+ value: faker.string.uuid(),
9
30
  },
10
31
  },
11
32
  headers: {
@@ -19,15 +40,15 @@ export const cloudFrontRequestFactory = new StaticFactory({
19
40
  value: "yulin.test",
20
41
  },
21
42
  "user-agent": {
22
- value: "Mozilla/5.0",
43
+ value: faker.internet.userAgent(),
23
44
  },
24
45
  },
25
- method: "GET",
46
+ method: faker.internet.httpMethod(),
26
47
  querystring: {
27
48
  page: {
28
49
  value: "1",
29
50
  },
30
51
  },
31
52
  uri: "/cloudfront/",
32
- });
53
+ }));
33
54
  //# sourceMappingURL=cloudfront-functions.factory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloudfront-functions.factory.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/factory/cloudfront-functions.factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,aAAa,CAAoB;IAC3E,OAAO,EAAE;QACP,SAAS,EAAE;YACT,KAAK,EAAE,iBAAiB;SACzB;KACF;IACD,OAAO,EAAE;QACP,MAAM,EAAE;YACN,KAAK,EAAE,iEAAiE;SACzE;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,gBAAgB;SACxB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,YAAY;SACpB;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,aAAa;SACrB;KACF;IACD,MAAM,EAAE,KAAK;IACb,WAAW,EAAE;QACX,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;SACX;KACF;IACD,GAAG,EAAE,cAAc;CACpB,CAAC,CAAC"}
1
+ {"version":3,"file":"cloudfront-functions.factory.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/factory/cloudfront-functions.factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC;;GAEG;AACH,MAAM,sBAAsB,GAAG,IAAI,cAAc,CAAkB,GAAG,EAAE,CAAC,CAAC;IACxE,OAAO,EAAE;QACP,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;YACpC,gBAAgB;YAChB,iBAAiB;SAClB,CAAC;QACF,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE;KAC/B;IACD,OAAO,EAAE,wBAAwB,CAAC,IAAI,EAAE;IACxC,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE;CACtC,CAAC,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAC9C,IAAI,cAAc,CAAkB,sBAAsB,EAAE;IAC1D,OAAO,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE;CACzC,CAAC,CAAC;AAEL;;GAEG;AACH,MAAM,wBAAwB,GAAG,IAAI,cAAc,CAAoB,GAAG,EAAE,CAAC,CAAC;IAC5E,OAAO,EAAE;QACP,SAAS,EAAE;YACT,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE;SAC3B;KACF;IACD,OAAO,EAAE;QACP,MAAM,EAAE;YACN,KAAK,EAAE,iEAAiE;SACzE;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,gBAAgB;SACxB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,YAAY;SACpB;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE;SAClC;KACF;IACD,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE;IACnC,WAAW,EAAE;QACX,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;SACX;KACF;IACD,GAAG,EAAE,cAAc;CACpB,CAAC,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
- export { cloudFrontRequestFactory } from "./factory/cloudfront-functions.factory.js";
1
+ export { cloudFrontViewerRequestEventFactory } from "./factory/cloudfront-functions.factory.js";
2
2
  export type { CloudFrontCookies, CloudFrontEvent, CloudFrontEventContext, CloudFrontHeaders, CloudFrontMultiValue, CloudFrontQueryString, CloudFrontRequest, CloudFrontResponse, CloudFrontValue, CloudFrontViewer, } from "./typings/cloudfront-functions.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/cloudfront/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/cloudfront/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,2CAA2C,CAAC;AAChG,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,mCAAmC,CAAC"}
@@ -1,2 +1,2 @@
1
- export { cloudFrontRequestFactory } from "./factory/cloudfront-functions.factory.js";
1
+ export { cloudFrontViewerRequestEventFactory } from "./factory/cloudfront-functions.factory.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/service/cloudfront/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/service/cloudfront/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,2CAA2C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kensio/yulin",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "AWS system behaviour simulation for isolated unit testing",
5
5
  "repository": "https://github.com/KensioSoftware/yulin",
6
6
  "type": "module",
@@ -25,12 +25,18 @@
25
25
  },
26
26
  "./package.json": "./package.json"
27
27
  },
28
+ "files": [
29
+ "dist",
30
+ "README.md",
31
+ "LICENSE"
32
+ ],
28
33
  "author": "Kensio Software",
29
34
  "license": "AGPL-3.0",
30
35
  "devDependencies": {
31
36
  "@aws-sdk/client-dynamodb": "^3.1056.0",
32
37
  "@aws-sdk/client-s3": "^3.1056.0",
33
38
  "@eslint/js": "^10.0.1",
39
+ "@faker-js/faker": "^10.4.0",
34
40
  "@kensio/smartass": "^1.0.0",
35
41
  "@smithy/smithy-client": "^4.13.5",
36
42
  "@smithy/types": "^4.14.2",
@@ -1,54 +0,0 @@
1
- ---
2
- name: PR
3
-
4
- on:
5
- pull_request:
6
- branches:
7
- - main
8
-
9
- defaults:
10
- run:
11
- shell: bash
12
-
13
- env:
14
- CI: true
15
-
16
- jobs:
17
- lint:
18
- name: Lint
19
- runs-on: blacksmith-4vcpu-ubuntu-2404
20
- steps:
21
- - uses: actions/checkout@v6
22
- - uses: pnpm/action-setup@v4
23
- - uses: actions/setup-node@v6
24
- with:
25
- node-version-file: .nvmrc
26
- cache: pnpm
27
- - run: pnpm install --frozen-lockfile
28
- - run: pnpm lint
29
-
30
- test:
31
- name: Test
32
- runs-on: blacksmith-4vcpu-ubuntu-2404
33
- steps:
34
- - uses: actions/checkout@v6
35
- - uses: pnpm/action-setup@v4
36
- - uses: actions/setup-node@v6
37
- with:
38
- node-version-file: .nvmrc
39
- cache: pnpm
40
- - run: pnpm install --frozen-lockfile
41
- - run: pnpm test:coverage
42
-
43
- build:
44
- name: Build
45
- runs-on: blacksmith-4vcpu-ubuntu-2404
46
- steps:
47
- - uses: actions/checkout@v6
48
- - uses: pnpm/action-setup@v4
49
- - uses: actions/setup-node@v6
50
- with:
51
- node-version-file: .nvmrc
52
- cache: pnpm
53
- - run: pnpm install --frozen-lockfile
54
- - run: pnpm build
@@ -1,5 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <state>
3
- <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
- </state>
5
- </component>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="EslintConfiguration">
4
- <option name="fix-on-save" value="true" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/yulin.iml" filepath="$PROJECT_DIR$/.idea/yulin.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="PrettierConfiguration">
4
- <option name="myConfigurationMode" value="AUTOMATIC" />
5
- <option name="myRunOnSave" value="true" />
6
- </component>
7
- </project>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- </component>
6
- </project>
package/.idea/yulin.iml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$" />
5
- <orderEntry type="inheritedJdk" />
6
- <orderEntry type="sourceFolder" forTests="false" />
7
- </component>
8
- </module>
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- v24.16.0
package/.prettierrc DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "trailingComma": "all",
3
- "tabWidth": 2
4
- }
package/eslint.config.ts DELETED
@@ -1,222 +0,0 @@
1
- import { dirname } from "node:path";
2
- import { fileURLToPath } from "node:url";
3
-
4
- import eslint from "@eslint/js";
5
- import vitest from "@vitest/eslint-plugin";
6
- import { defineConfig } from "eslint/config";
7
- import prettier from "eslint-config-prettier";
8
- import { jsdoc } from "eslint-plugin-jsdoc";
9
- import noSecrets from "eslint-plugin-no-secrets";
10
- import security from "eslint-plugin-security";
11
- import unicorn from "eslint-plugin-unicorn";
12
- import globals from "globals";
13
- import tseslint from "typescript-eslint";
14
-
15
- const __dirname = dirname(fileURLToPath(import.meta.url));
16
-
17
- const securityRecommended = security.configs.recommended as Parameters<
18
- typeof defineConfig
19
- >[0];
20
-
21
- export default defineConfig(
22
- // ── Global ignores ──────────────────────────────────────
23
- {
24
- ignores: ["dist/", "**/.coverage/*", "node_modules/", "*.config.ts"],
25
- },
26
-
27
- // ── Base ESLint recommended ─────────────────────────────
28
- eslint.configs.recommended,
29
-
30
- // ── TypeScript (strictest level + type-aware) ───────────
31
- ...tseslint.configs.strictTypeChecked,
32
- ...tseslint.configs.stylisticTypeChecked,
33
-
34
- // ── General settings for all TS files ───────────────────
35
- {
36
- languageOptions: {
37
- ecmaVersion: "latest",
38
- sourceType: "module",
39
- globals: {
40
- ...globals.node,
41
- },
42
- parserOptions: {
43
- projectService: true,
44
- tsconfigRootDir: __dirname,
45
- },
46
- },
47
- rules: {
48
- // ── TypeScript overrides & additions ──────────────
49
- "@typescript-eslint/explicit-function-return-type": "error",
50
- "@typescript-eslint/explicit-module-boundary-types": "error",
51
- "@typescript-eslint/no-explicit-any": "error",
52
- "@typescript-eslint/consistent-type-imports": [
53
- "error",
54
- { prefer: "type-imports", fixStyle: "inline-type-imports" },
55
- ],
56
- "@typescript-eslint/consistent-type-exports": [
57
- "error",
58
- { fixMixedExportsWithInlineTypeSpecifier: true },
59
- ],
60
- "@typescript-eslint/no-import-type-side-effects": "error",
61
- "@typescript-eslint/switch-exhaustiveness-check": "error",
62
- "@typescript-eslint/no-unnecessary-condition": "error",
63
- "@typescript-eslint/prefer-nullish-coalescing": "error",
64
- "@typescript-eslint/strict-boolean-expressions": "error",
65
- "no-await-in-loop": "error", // catches sequential awaits that should be Promise.all()
66
- "no-template-curly-in-string": "error", // catches '${name}' in regular strings (missing backticks)
67
- "no-promise-executor-return": "error", // catches accidental return in new Promise((resolve) => return ...)
68
- "no-unreachable-loop": "error", // catches loops that only ever run once
69
- "no-param-reassign": "error", // prevents mutating function parameters (major bug source)
70
- "prefer-const": "error", // const over let when never reassigned
71
- "object-shorthand": ["error", "always"], // { foo: foo } → { foo }
72
- "prefer-template": "error", // template literals over string concatenation
73
- "@typescript-eslint/prefer-readonly": "error", // flags private fields that are never reassigned
74
- "@typescript-eslint/require-array-sort-compare": "error", // prevents [1, 10, 2].sort() (lexicographic surprise)
75
- "@typescript-eslint/naming-convention": [
76
- "error",
77
- {
78
- selector: ["property", "objectLiteralProperty", "typeProperty"],
79
- format: ["camelCase", "PascalCase"],
80
- leadingUnderscore: "allow",
81
- },
82
- {
83
- selector: ["property", "objectLiteralProperty", "typeProperty"],
84
- modifiers: ["requiresQuotes"],
85
- format: null,
86
- },
87
- {
88
- selector: "default",
89
- format: ["camelCase"],
90
- leadingUnderscore: "allow",
91
- },
92
- {
93
- selector: "typeLike",
94
- format: ["PascalCase"],
95
- },
96
- {
97
- selector: "enumMember",
98
- format: ["PascalCase"],
99
- },
100
- {
101
- selector: "variable",
102
- modifiers: ["const", "exported"],
103
- format: ["camelCase", "UPPER_CASE"],
104
- },
105
- ],
106
-
107
- // ── General quality ──────────────────────────────
108
- "no-console": "warn",
109
- eqeqeq: ["error", "always"],
110
- curly: ["error", "all"],
111
- "@typescript-eslint/only-throw-error": "error",
112
- },
113
- },
114
-
115
- // ── Security (low-cost security checks) ────────────────
116
- securityRecommended,
117
-
118
- // ── Unicorn (modern JS best practices) ──────────────────
119
- // https://github.com/sindresorhus/eslint-plugin-unicorn?tab=readme-ov-file#recommended-config
120
- unicorn.configs.recommended,
121
- {
122
- rules: {
123
- "unicorn/better-regex": "warn",
124
- "unicorn/prevent-abbreviations": "off",
125
- "unicorn/no-null": "off",
126
- },
127
- },
128
- {
129
- files: ["**/index.ts"],
130
- rules: {
131
- "unicorn/no-empty-file": "off",
132
- },
133
- },
134
-
135
- // ── Vitest (test files only) ────────────────────────────
136
- {
137
- files: ["**/*.test.ts"],
138
- plugins: {
139
- vitest,
140
- },
141
- rules: {
142
- ...vitest.configs.recommended.rules,
143
- "vitest/consistent-test-it": ["error", { fn: "it" }],
144
- "vitest/no-focused-tests": "error",
145
- "vitest/no-disabled-tests": "warn",
146
- "vitest/no-duplicate-hooks": "error",
147
- "vitest/prefer-to-be": "error",
148
- "vitest/prefer-to-have-length": "error",
149
- "vitest/prefer-strict-equal": "error",
150
- "vitest/require-top-level-describe": "error",
151
- "vitest/expect-expect": "off",
152
-
153
- // Relax some rules that are too strict for test files
154
- "@typescript-eslint/no-explicit-any": "off",
155
- "@typescript-eslint/no-unsafe-assignment": "off",
156
- "@typescript-eslint/no-unsafe-member-access": "off",
157
- "@typescript-eslint/explicit-function-return-type": "off",
158
- "import-x/no-default-export": "off",
159
- },
160
- },
161
-
162
- // ── Config files (allow default exports) ────────────────
163
- {
164
- files: ["*.config.ts", "*.config.js"],
165
- rules: {
166
- "import-x/no-default-export": "off",
167
- },
168
- },
169
-
170
- // ── No Secrets (detect accidental secret inclusion) ────────
171
- {
172
- plugins: { "no-secrets": noSecrets },
173
- rules: {
174
- "no-secrets/no-secrets": "error",
175
- },
176
- },
177
-
178
- // ── JSDoc (enforce minimal doc commenting) ────────────────
179
- jsdoc({
180
- config: "flat/recommended-error",
181
- }),
182
- {
183
- rules: {
184
- "jsdoc/require-param": "off",
185
- "jsdoc/require-returns": "off",
186
- "jsdoc/require-param-description": "off",
187
- "jsdoc/require-returns-description": "off",
188
- "jsdoc/require-yields": "off",
189
- "jsdoc/require-description": [
190
- "error",
191
- {
192
- descriptionStyle: "body",
193
- checkConstructors: false,
194
- checkGetters: false,
195
- checkSetters: false,
196
- },
197
- ],
198
- "jsdoc/require-jsdoc": [
199
- "error",
200
- {
201
- contexts: [
202
- "ClassDeclaration",
203
- "ExportNamedDeclaration > VariableDeclaration[kind='const'] > VariableDeclarator[init.type='ObjectExpression']",
204
- "ExportNamedDeclaration > VariableDeclaration[kind='const'] > VariableDeclarator[init.type='ArrayExpression']",
205
- "ExportNamedDeclaration > VariableDeclaration[kind='const'] > VariableDeclarator[init.type='NewExpression']",
206
- "ExportNamedDeclaration > VariableDeclaration[kind='const'] > VariableDeclarator[init.type='CallExpression']",
207
- ],
208
- publicOnly: true,
209
- checkConstructors: false,
210
- require: {
211
- FunctionDeclaration: true,
212
- MethodDefinition: true,
213
- ClassDeclaration: true,
214
- },
215
- },
216
- ],
217
- },
218
- },
219
-
220
- // ── Prettier (must be last — disables conflicting rules)
221
- prettier,
222
- );
@@ -1,23 +0,0 @@
1
- minimumReleaseAgeExclude:
2
- - '@aws-sdk/client-dynamodb@3.1056.0'
3
- - '@aws-sdk/client-s3@3.1056.0'
4
- - '@aws-sdk/core@3.974.15'
5
- - '@aws-sdk/credential-provider-env@3.972.41'
6
- - '@aws-sdk/credential-provider-http@3.972.43'
7
- - '@aws-sdk/credential-provider-ini@3.972.45'
8
- - '@aws-sdk/credential-provider-login@3.972.45'
9
- - '@aws-sdk/credential-provider-node@3.972.46'
10
- - '@aws-sdk/credential-provider-process@3.972.41'
11
- - '@aws-sdk/credential-provider-sso@3.972.45'
12
- - '@aws-sdk/credential-provider-web-identity@3.972.45'
13
- - '@aws-sdk/dynamodb-codec@3.973.15'
14
- - '@aws-sdk/middleware-bucket-endpoint@3.972.17'
15
- - '@aws-sdk/middleware-endpoint-discovery@3.972.15'
16
- - '@aws-sdk/middleware-expect-continue@3.972.14'
17
- - '@aws-sdk/middleware-flexible-checksums@3.974.23'
18
- - '@aws-sdk/middleware-sdk-s3@3.972.44'
19
- - '@aws-sdk/nested-clients@3.997.13'
20
- - '@aws-sdk/signature-v4-multi-region@3.996.30'
21
- - '@aws-sdk/token-providers@3.1056.0'
22
- - '@kensio/smartass@1.0.0'
23
- useNodeVersion: 24.16.0
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -Eeuo pipefail
4
-
5
- pnpm install
6
- pnpm lint
7
- pnpm test:coverage
8
- pnpm build
9
- pnpm pack --dry-run
10
- pnpm version patch
11
- pnpm login
12
- pnpm publish --access public
13
- git push
14
- git push --tags
@@ -1,3 +0,0 @@
1
- export interface CommandHandler<TCommand, TOutput> {
2
- handle(cmd: TCommand): Promise<TOutput>;
3
- }
package/src/index.ts DELETED
File without changes
@@ -1,10 +0,0 @@
1
- import { describe, it } from "vitest";
2
- import { cloudFrontRequestFactory } from "./cloudfront-functions.factory.js";
3
- import { assertObjectMatches } from "@kensio/smartass";
4
-
5
- describe("CloudFront Functions object factories", () => {
6
- it("makes a valid CloudFront Functions request object", () => {
7
- const cffReq = cloudFrontRequestFactory.make();
8
- assertObjectMatches(cffReq, { headers: { host: { value: "yulin.test" } } });
9
- });
10
- });
@@ -1,34 +0,0 @@
1
- import type { CloudFrontRequest } from "../typings/cloudfront-functions.js";
2
- import { StaticFactory } from "@kensio/part-factory";
3
-
4
- /**
5
- * Makes instances of the CloudFrontRequest object structure.
6
- */
7
- export const cloudFrontRequestFactory = new StaticFactory<CloudFrontRequest>({
8
- cookies: {
9
- sessionId: {
10
- value: "test-session-id",
11
- },
12
- },
13
- headers: {
14
- accept: {
15
- value: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
16
- },
17
- "accept-language": {
18
- value: "en-GB,en;q=0.9",
19
- },
20
- host: {
21
- value: "yulin.test",
22
- },
23
- "user-agent": {
24
- value: "Mozilla/5.0",
25
- },
26
- },
27
- method: "GET",
28
- querystring: {
29
- page: {
30
- value: "1",
31
- },
32
- },
33
- uri: "/cloudfront/",
34
- });
@@ -1,13 +0,0 @@
1
- export { cloudFrontRequestFactory } from "./factory/cloudfront-functions.factory.js";
2
- export type {
3
- CloudFrontCookies,
4
- CloudFrontEvent,
5
- CloudFrontEventContext,
6
- CloudFrontHeaders,
7
- CloudFrontMultiValue,
8
- CloudFrontQueryString,
9
- CloudFrontRequest,
10
- CloudFrontResponse,
11
- CloudFrontValue,
12
- CloudFrontViewer,
13
- } from "./typings/cloudfront-functions.js";
@@ -1,48 +0,0 @@
1
- export interface CloudFrontValue {
2
- value: string;
3
- }
4
-
5
- export interface CloudFrontMultiValue {
6
- multiValue: CloudFrontValue[];
7
- }
8
-
9
- export type CloudFrontHeaders = Record<string, CloudFrontValue>;
10
-
11
- export type CloudFrontQueryString = Record<
12
- string,
13
- CloudFrontValue | CloudFrontMultiValue
14
- >;
15
-
16
- export type CloudFrontCookies = Record<string, CloudFrontValue>;
17
-
18
- export interface CloudFrontRequest {
19
- method: string;
20
- uri: string;
21
- headers: CloudFrontHeaders;
22
- querystring: CloudFrontQueryString;
23
- cookies: CloudFrontCookies;
24
- }
25
-
26
- export interface CloudFrontResponse {
27
- statusCode: number;
28
- statusDescription?: string;
29
- headers?: CloudFrontHeaders;
30
- }
31
-
32
- export interface CloudFrontEventContext {
33
- distributionDomainName?: string;
34
- endpoint?: string;
35
- distributionId?: string;
36
- eventType: "viewer-request" | "viewer-response";
37
- requestId: string;
38
- }
39
-
40
- export interface CloudFrontViewer {
41
- ip: string;
42
- }
43
-
44
- export interface CloudFrontEvent {
45
- context: CloudFrontEventContext;
46
- viewer: CloudFrontViewer;
47
- request: CloudFrontRequest;
48
- }