Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Housekeeping #5

Merged
merged 9 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "plugin:bpmn-io/es5"
"extends": "plugin:bpmn-io/recommended"
}
18 changes: 18 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CI
on: [ push, pull_request ]
jobs:
Build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run all
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules/
tmp/
package-lock.json
dist/
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ ___Note:__ Yet to be released changes appear here._

## 0.4.0

* `FEAT`: add type definitions
* `FEAT`: add `module` export
* `CHORE`: export `Refs` and `Collection` as a named exports

### Breaking Changes

* `Refs` and `Collection` are now exposed via a named export.

## 0.3.0

* `FEAT`: transitively bind inverse one-to-many relationships ([#1](https://github.com/bpmn-io/object-refs/issues/1))
* `FEAT`: be able to define configurable properties ([#3](https://github.com/bpmn-io/object-refs/issues/3))

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# object-refs

[![Build Status](https://travis-ci.com/bpmn-io/object-refs.svg?branch=master)](https://travis-ci.com/bpmn-io/object-refs)
[![CI](https://github.com/bpmn-io/object-refs/actions/workflows/CI.yml/badge.svg)](https://github.com/bpmn-io/object-refs/actions/workflows/CI.yml)

A minimal implementation of bi-directional object references for JavaScript.

Expand Down
42 changes: 42 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
export type AttributeDescriptor = {
name: string;
collection?: boolean | undefined;
enumerable?: boolean | undefined;
}

export class Refs {

/**
* Creates a new references object defining two inversly related
* attribute descriptors a and b.
* @param {AttributeDescriptor} a property descriptor
* @param {AttributeDescriptor} b property descriptor
*/
constructor(a: AttributeDescriptor, b: AttributeDescriptor);

/**
* Binds one side of a bi-directional reference to a target object.
* @param {*} target
* @param {string|AttributeDescriptor} property
*/
bind(target: any, property: string | AttributeDescriptor): void;

ensureBound(target: any, property: string | AttributeDescriptor): void;

ensureRefsCollection(target: any, property: AttributeDescriptor): any;

set(target: any, property: string | AttributeDescriptor, value: any): void;

unset(target: any, property: string | AttributeDescriptor, value: any): void;
}

export namespace Collection {

/**
* Extends a collection with Refs aware methods
*/
function extend(collection: any[], refs: Refs, property: string | AttributeDescriptor, target: any): any;

function isExtended(collection: any[]): boolean;

}
3 changes: 0 additions & 3 deletions index.js

This file was deleted.

Loading