From dc8c3c5d63e4e607b35556ca4237871adab5257b Mon Sep 17 00:00:00 2001 From: John Gilbert Date: Thu, 16 Oct 2025 09:13:17 -0400 Subject: [PATCH 1/3] npm-oidc --- .github/workflows/cd.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 61e2828..5b7f1d1 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -5,6 +5,10 @@ on: # push: # branches: [ master ] +permissions: + id-token: write # Required for OIDC + contents: read + jobs: publish: runs-on: ubuntu-latest @@ -14,11 +18,12 @@ jobs: with: node-version: 18.x registry-url: https://registry.npmjs.org/ + # Ensure npm 11.5.1 or later is installed + - name: Update npm + run: npm install -g npm@latest - run: npm ci - run: npm test - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} - uses: sergeysova/jq-action@v2 name: Derive Version id: version From 420d280fe8ae13dbb206e7a06c9e3a4887f57553 Mon Sep 17 00:00:00 2001 From: John Gilbert Date: Thu, 30 Oct 2025 23:06:42 -0400 Subject: [PATCH 2/3] enabled pipelines env var --- src/pipelines/index.js | 8 ++++-- test/unit/pipelines/pipelines.test.js | 37 ++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/pipelines/index.js b/src/pipelines/index.js index 1dc3025..33729c0 100644 --- a/src/pipelines/index.js +++ b/src/pipelines/index.js @@ -49,9 +49,13 @@ export const initializeFrom = (rules) => rules.reduce( ); const assemble = (opt) => (head, includeFaultHandler = true) => { - const disabledPipelines = process.env.DISABLED_PIPELINES?.split(','); + const enabledPipelines = (opt.ENABLED_PIPELINES || process.env.ENABLED_PIPELINES)?.split(','); + const disabledPipelines = (opt.DISABLED_PIPELINES || process.env.DISABLED_PIPELINES)?.split(','); const keys = Object.keys(thePipelines) - .filter((k) => !disabledPipelines?.includes(k)); + .filter((k) => !disabledPipelines?.includes(k)) + .filter((k) => + !enabledPipelines || enabledPipelines.length === 0 + || enabledPipelines.includes(k)); debug('assemble: %j', keys); diff --git a/test/unit/pipelines/pipelines.test.js b/test/unit/pipelines/pipelines.test.js index 4b47d8c..8b0866a 100644 --- a/test/unit/pipelines/pipelines.test.js +++ b/test/unit/pipelines/pipelines.test.js @@ -12,9 +12,14 @@ import Connector from '../../../src/connectors/eventbridge'; describe('pipelines/index.js', () => { beforeEach(() => { sinon.stub(Connector.prototype, 'putEvents').resolves({ FailedEntryCount: 0 }); + delete process.env.ENABLED_PIPELINES; delete process.env.DISABLED_PIPELINES; }); - afterEach(sinon.restore); + afterEach(() => { + delete process.env.ENABLED_PIPELINES; + delete process.env.DISABLED_PIPELINES; + sinon.restore(); + }); it('should invoke all pipelines', (done) => { let counter = 0; @@ -46,6 +51,36 @@ describe('pipelines/index.js', () => { .done(done); }); + it('should only run enabled pipelines - string', (done) => { + process.env.ENABLED_PIPELINES = 'p1,p1b'; + let counter = 0; + + const count = (uow) => { + uow.counter = counter++; // eslint-disable-line no-plusplus + return uow; + }; + + const events = toKinesisRecords([{ + type: 't1', + }]); + + initialize({ + p1: (opt) => (s) => s.map(count), + p1a: (opt) => (s) => s.map(count), + p1b: (opt) => (s) => s.map(count), + }) + .assemble(fromKinesis(events), false) + .collect() + .tap((collected) => { + // console.log(JSON.stringify(collected, null, 2)); + expect(collected.length).to.equal(2); + expect(counter).to.equal(2); + expect(collected[0].pipeline).to.equal('p1b'); + expect(collected[1].pipeline).to.equal('p1'); + }) + .done(done); + }); + it('should ignore disabled pipelines - string', (done) => { process.env.DISABLED_PIPELINES = 'p1a'; let counter = 0; From 9e3b9b295f21607aa798a6fbd5474aae44cab730 Mon Sep 17 00:00:00 2001 From: John Gilbert Date: Sat, 1 Nov 2025 16:42:50 -0400 Subject: [PATCH 3/3] enabled pipelines env var --- package-lock.json | 4 ++-- package.json | 2 +- src/pipelines/index.js | 4 ++-- test/unit/pipelines/pipelines.test.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 62882ba..fcd194f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "aws-lambda-stream", - "version": "1.1.13", + "version": "1.1.14", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "aws-lambda-stream", - "version": "1.1.13", + "version": "1.1.14", "license": "MIT", "dependencies": { "object-sizeof": "^2.6.0" diff --git a/package.json b/package.json index 98782f1..ebd915b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aws-lambda-stream", - "version": "1.1.13", + "version": "1.1.14", "description": "Create stream processors with AWS Lambda functions.", "keywords": [ "aws", diff --git a/src/pipelines/index.js b/src/pipelines/index.js index 33729c0..96e396b 100644 --- a/src/pipelines/index.js +++ b/src/pipelines/index.js @@ -49,8 +49,8 @@ export const initializeFrom = (rules) => rules.reduce( ); const assemble = (opt) => (head, includeFaultHandler = true) => { - const enabledPipelines = (opt.ENABLED_PIPELINES || process.env.ENABLED_PIPELINES)?.split(','); - const disabledPipelines = (opt.DISABLED_PIPELINES || process.env.DISABLED_PIPELINES)?.split(','); + const enabledPipelines = (opt.ENABLED_PIPELINES || process.env.ENABLED_PIPELINES)?.split(',').map((pipeline) => pipeline.trim()); + const disabledPipelines = (opt.DISABLED_PIPELINES || process.env.DISABLED_PIPELINES)?.split(',').map((pipeline) => pipeline.trim()); const keys = Object.keys(thePipelines) .filter((k) => !disabledPipelines?.includes(k)) .filter((k) => diff --git a/test/unit/pipelines/pipelines.test.js b/test/unit/pipelines/pipelines.test.js index 8b0866a..ebeb9e7 100644 --- a/test/unit/pipelines/pipelines.test.js +++ b/test/unit/pipelines/pipelines.test.js @@ -52,7 +52,7 @@ describe('pipelines/index.js', () => { }); it('should only run enabled pipelines - string', (done) => { - process.env.ENABLED_PIPELINES = 'p1,p1b'; + process.env.ENABLED_PIPELINES = 'p1,p1b '; // extra space on purpose let counter = 0; const count = (uow) => {