Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/azure/cosmos-4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shazron authored Feb 6, 2024
2 parents 308ff43 + 1eee5df commit fd7a03e
Show file tree
Hide file tree
Showing 27 changed files with 1,141 additions and 1,434 deletions.
27 changes: 1 addition & 26 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,4 @@ on:

jobs:
build:
if: github.repository_owner == 'adobe'
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [14]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm i --package-lock --package-lock-only
- run: npm ci
- name: run unit tests
run: npm run test
- name: Slack Notification
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: 'Node version'
SLACK_MESSAGE: ${{ matrix.node-version }}
SLACK_COLOR: ${{ job.status == 'success' && 'good' || job.status == 'cancelled' && '#808080' || 'danger' }}

uses: adobe/aio-reusable-workflows/.github/workflows/daily.yml@main
24 changes: 1 addition & 23 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,4 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [14.x, 16.x]
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm i --package-lock --package-lock-only
- run: npm ci
- run: npm run build --if-present
- run: npm test
- name: upload coverage
if: success()
uses: codecov/[email protected]
with:
name: ${{ runner.os }} node.js ${{ matrix.node-version }}
uses: adobe/aio-reusable-workflows/.github/workflows/node.js.yml@main
13 changes: 1 addition & 12 deletions .github/workflows/on-push-publish-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,4 @@ on:
- 'package.json'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- run: npm install
- run: npm test
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
access: 'public'
uses: adobe/aio-reusable-workflows/.github/workflows/on-push-publish-to-npm.yml@main
27 changes: 1 addition & 26 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,4 @@ on:

jobs:
checkout:
name: checkout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git config user.name github-actions
git config user.email [email protected]
- uses: actions/setup-node@v1
with:
node-version: 16
- run: |
npm install
npm test
- name: Update your package.json with an npm pre-release version
id: pre-release-version
uses: adobe/[email protected]
with:
pre-release-tag: ${{ github.event.inputs.pre-release-tag }}
dependencies-to-update: ${{ github.event.inputs.dependencies-to-update }}
dependencies-to-update-version-tag: ${{ github.event.inputs.dist-tag }}
- run: echo pre-release-version - ${{ steps.pre-release-version.outputs.pre-release-version }}
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
tag: ${{ github.event.inputs.dist-tag }}
access: 'public'
uses: adobe/aio-reusable-workflows/.github/workflows/prerelease.yml@main
24 changes: 1 addition & 23 deletions .github/workflows/version-bump-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,4 @@ on:
default: 'latest'
jobs:
checkout:
name: checkout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git config user.name github-actions
git config user.email [email protected]
- uses: actions/setup-node@v1
with:
node-version: 16
- run: |
npm install
npm test
- name: bump and pub
if: ${{ github.event.inputs.level != '' }}
run: |
npm version ${{ github.event.inputs.level }}
git push
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
tag: ${{ github.event.inputs.tag }}
access: 'public'
uses: adobe/aio-reusable-workflows/.github/workflows/version-bump-publish.yml@main
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright 2019 Adobe. All rights reserved.
Copyright 2024 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand All @@ -10,20 +10,18 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
-->

# Adobe I/O Lib State

[![Version](https://img.shields.io/npm/v/@adobe/aio-lib-state.svg)](https://npmjs.org/package/@adobe/aio-lib-state)
[![Downloads/week](https://img.shields.io/npm/dw/@adobe/aio-lib-state.svg)](https://npmjs.org/package/@adobe/aio-lib-state)
![Node.js CI](https://github.com/adobe/aio-lib-state/workflows/Node.js%20CI/badge.svg)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Codecov Coverage](https://img.shields.io/codecov/c/github/adobe/aio-lib-state/master.svg?style=flat-square)](https://codecov.io/gh/adobe/aio-lib-state/)

# Adobe I/O Lib State

A Node JavaScript abstraction on top of distributed/cloud DBs that exposes a simple state persistence API.

You can initialize the lib with your Adobe I/O Runtime (a.k.a OpenWhisk) credentials.

Alternatively, you can bring your own cloud db keys. As of now we only support Azure Cosmos.

Please note that currently you must be a customer of [Adobe Developer App Builder](https://www.adobe.io/apis/experienceplatform/project-firefly.html) to use this library. App Builder is a complete framework that enables enterprise developers to build and deploy custom web applications that extend Adobe Experience Cloud solutions and run on Adobe infrastructure.

## Install
Expand All @@ -39,19 +37,23 @@ npm install @adobe/aio-lib-state

// init when running in an Adobe I/O Runtime action (OpenWhisk) (uses env vars __OW_API_KEY and __OW_NAMESPACE automatically)
const state = await stateLib.init()
// or if you want to use your own cloud DB account (make sure your partition key path is /partitionKey)
const state = await stateLib.init({ cosmos: { endpoint, masterKey, databaseId, containerId, partitionKey } })

// get
const res = await state.get('key') // res = { value, expiration }
const value = res.value

// put
await state.put('key', 'value')
await state.put('key', { anObject: 'value' }, { ttl: -1 }) // -1 for no expiry, defaults to 86400 (24 hours)
await state.put('another key', 'another value', { ttl: -1 }) // -1 for no expiry, defaults to 86400 (24 hours)

// delete
await state.delete('key')

// delete all keys and values
await state.deleteAll()

// returns true if you have at least one key and value
await state.any()
```

## Explore
Expand Down
Loading

0 comments on commit fd7a03e

Please sign in to comment.