Skip to content

Commit

Permalink
rename core packages: core -> common; di-core -> core
Browse files Browse the repository at this point in the history
closes #4
  • Loading branch information
DanielSchaffer committed Jul 25, 2018
1 parent 02f1554 commit 6542029
Show file tree
Hide file tree
Showing 244 changed files with 698 additions and 707 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ allow developers to use only the features they require.

# Core Modules

* **[@dandi/core](./core)** 🕸 - Core types and utilities
* **[@dandi/common](./common)** 🕸 - Common types and utilities
* **[@dandi/core](./core)** - Dependency Injection
* **[@dandi/data](./data)** - Base types and utilities for working with data services
* **[@dandi/config](./config)** - Configuration services
* **[@dandi/di-core](./di-core)** - Dependency Injection
* **[@dandi/model](./model)** 🕸 - Model decorators
* **[@dandi/model-validation](./model-validation)** - Model validation utilities
* **[@dandi/mvc](./mvc)** - MVC decorators and base utilities (not specific to Express)

# 3rd Party Integration Modules
* **[@dandi/aws-lambda](./aws-lambda-wrap)** Helpers for using `@dandi/di-core` with AWS Lambda
* **[@dandi/aws-lambda](./aws-lambda-wrap)** Helpers for using `@dandi/di-common` with AWS Lambda
* **[@dandi/config-aws-ssm](./config-aws-ssm)** - `@dandi/config` client for AWS SSM Parameter Store
* **[@dandi/data-pg](./data-pg)** - `@dandi/data` client implementations for Postgres
* **[@dandi/mvc-auth-firebase](./mvc-auth-firebase)** - Google Firebase Authorization service implementation for `@dandi/mvc`
Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Implementations of `HttpResponseInterceptor` can be used to modify

```typescript
// my-interceptor.ts
import { Injectable } from '@dandi/di-core';
import { Injectable } from '@dandi/core';
import { HttpResponseInterceptor } from '@dandi/aws-lambda';
import { APIGatewayProxyResult } from 'aws-lambda';

Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/npm.link
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

npm link @dandi/common
npm link @dandi/core
npm link @dandi/di-core
npm link @dandi/model-validation
2 changes: 1 addition & 1 deletion aws-lambda-wrap/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions aws-lambda-wrap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dandi/aws-lambda",
"version": "1.0.0-alpha.12",
"version": "1.0.0-alpha.13",
"scripts": {},
"repository": {
"type": "git",
Expand All @@ -13,9 +13,9 @@
"homepage": "https://github.com/dandi-mvc/dandi#readme",
"module": "index.js",
"peerDependencies": {
"@dandi/core": "1.0.0-alpha.12",
"@dandi/di-core": "1.0.0-alpha.12",
"@dandi/model-validation": "1.0.0-alpha.12"
"@dandi/common": "1.0.0-alpha.13",
"@dandi/core": "1.0.0-alpha.13",
"@dandi/model-validation": "1.0.0-alpha.13"
},
"dependencies": {
"aws-lambda": "^0.1.2"
Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/dandi.aws.lambda.error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppError } from '@dandi/core';
import { AppError } from '@dandi/common';

export class DandiAwsLambdaError extends AppError {

Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/dynamo.stream.event.transformer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Injectable } from '@dandi/di-core';
import { Injectable } from '@dandi/core';

import { DynamoDBRecord, DynamoDBStreamEvent } from 'aws-lambda';

Expand Down
4 changes: 2 additions & 2 deletions aws-lambda-wrap/src/http.event.options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Constructor } from '@dandi/core';
import { InjectionToken } from '@dandi/di-core';
import { Constructor } from '@dandi/common';
import { InjectionToken } from '@dandi/core';

import { localOpinionatedToken } from './local.token';

Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/http.event.transformer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { stubProvider, testHarness } from '@dandi/di-core-testing';
import { stubProvider, testHarness } from '@dandi/core-testing';
import { DecoratorModelValidator, ModelValidator } from '@dandi/model-validation';

import { APIGatewayProxyEvent, Context } from 'aws-lambda';
Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/http.event.transformer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Inject, Injectable, Optional } from '@dandi/di-core';
import { Inject, Injectable, Optional } from '@dandi/core';
import { ModelValidator } from '@dandi/model-validation';

import { APIGatewayProxyEvent, APIGatewayEventRequestContext, Context } from 'aws-lambda';
Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/http.handler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// /* eslint no-magic-numbers: ['error', { 'ignore': [200,500] }] */
//
// import { ErrorUtil } from '@dandi/core';
// import { ErrorUtil } from '@dandi/common';
//
// import {
// APIGatewayEventRequestContext,
Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/http.responder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { stubProvider, testHarness } from '@dandi/di-core-testing';
import { stubProvider, testHarness } from '@dandi/core-testing';
import { APIGatewayProxyResult } from 'aws-lambda';

import { expect } from 'chai';
Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/http.responder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Inject, Injectable, Optional } from '@dandi/di-core';
import { Inject, Injectable, Optional } from '@dandi/core';

import { APIGatewayProxyResult } from 'aws-lambda';

Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/http.response.interceptor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InjectionToken } from '@dandi/di-core';
import { InjectionToken } from '@dandi/core';

import { APIGatewayProxyResult } from 'aws-lambda';

Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/lambda.error.handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InjectionToken } from '@dandi/di-core';
import { InjectionToken } from '@dandi/core';

import { localOpinionatedToken } from './local.token';

Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/lambda.event.transformer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InjectionToken } from '@dandi/di-core';
import { InjectionToken } from '@dandi/core';

import { Context } from 'aws-lambda';

Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/lambda.responder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InjectionToken } from '@dandi/di-core';
import { InjectionToken } from '@dandi/core';

import { localOpinionatedToken } from './local.token';

Expand Down
4 changes: 2 additions & 2 deletions aws-lambda-wrap/src/lambda.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LambdaErrorHandler } from '@dandi/aws-lambda-wrap';
import { AmbientInjectableScanner } from '@dandi/di-core';
import { stubProvider, testHarness } from '@dandi/di-core-testing';
import { AmbientInjectableScanner } from '@dandi/core';
import { stubProvider, testHarness } from '@dandi/core-testing';

import { Context } from 'aws-lambda';

Expand Down
4 changes: 2 additions & 2 deletions aws-lambda-wrap/src/lambda.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Constructor } from '@dandi/core';
import { Constructor } from '@dandi/common';
import {
AmbientInjectableScanner,
Container,
Expand All @@ -7,7 +7,7 @@ import {
InjectionToken,
Optional,
Repository,
} from '@dandi/di-core';
} from '@dandi/core';

import { Context } from 'aws-lambda';

Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/local.token.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InjectionOptions, InjectionToken, OpinionatedToken, SymbolToken } from '@dandi/di-core';
import { InjectionOptions, InjectionToken, OpinionatedToken, SymbolToken } from '@dandi/core';

const PKG = '@dandi/aws-lambda';

Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-wrap/src/sns.handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ErrorUtil } from '@dandi/core';
import { ErrorUtil } from '@dandi/common';

import { SNSEvent } from 'aws-lambda';

Expand Down
2 changes: 1 addition & 1 deletion cache/npm.link
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash

npm link @dandi/common
npm link @dandi/core
npm link @dandi/di-core
2 changes: 1 addition & 1 deletion cache/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions cache/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dandi/cache",
"version": "1.0.0-alpha.12",
"version": "1.0.0-alpha.13",
"scripts": {},
"repository": {
"type": "git",
Expand All @@ -17,7 +17,7 @@
"uuid": "^3.2.1"
},
"peerDependencies": {
"@dandi/core": "1.0.0-alpha.12",
"@dandi/di-core": "1.0.0-alpha.12"
"@dandi/common": "1.0.0-alpha.13",
"@dandi/core": "1.0.0-alpha.13"
}
}
2 changes: 1 addition & 1 deletion cache/src/cache.key.generator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InjectionToken } from '@dandi/di-core';
import { InjectionToken } from '@dandi/core';

import { localOpinionatedToken } from './local.token';

Expand Down
4 changes: 2 additions & 2 deletions cache/src/cache.provider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Duration } from '@dandi/core';
import { MappedInjectionToken } from '@dandi/di-core';
import { Duration } from '@dandi/common';
import { MappedInjectionToken } from '@dandi/core';

import { localOpinionatedToken } from './local.token';

Expand Down
4 changes: 2 additions & 2 deletions cache/src/cascading.cache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Duration } from '@dandi/core';
import { Inject, Injectable, Optional } from '@dandi/di-core';
import { Duration } from '@dandi/common';
import { Inject, Injectable, Optional } from '@dandi/core';

import { Cache, CacheProvider, CacheProviderType } from './cache.provider';

Expand Down
2 changes: 1 addition & 1 deletion cache/src/local.token.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InjectionOptions, InjectionToken, OpinionatedToken, SymbolToken } from '@dandi/di-core';
import { InjectionOptions, InjectionToken, OpinionatedToken, SymbolToken } from '@dandi/core';

const PKG = '@dandi/cache';

Expand Down
4 changes: 2 additions & 2 deletions cache/src/memory.cache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Duration } from '@dandi/core';
import { Injectable, Singleton } from '@dandi/di-core';
import { Duration } from '@dandi/common';
import { Injectable, Singleton } from '@dandi/core';

import { Cache, CacheProvider, CacheProviderType } from './cache.provider';
import Timer = NodeJS.Timer;
Expand Down
2 changes: 1 addition & 1 deletion cache/src/service.context.cache.key.generator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Inject, Injectable, InjectionContext, InjectionToken } from '@dandi/di-core';
import { Inject, Injectable, InjectionContext, InjectionToken } from '@dandi/core';

import { CacheKeyGenerator } from './cache.key.generator';

Expand Down
9 changes: 0 additions & 9 deletions cleanup.sh

This file was deleted.

52 changes: 52 additions & 0 deletions common/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# @dandi/common

`@dandi/common` provides common types and utilities for the rest of the
`@dandi` system.

`@dandi/common` does not have any dependencies on NodeJS, and therefore
can be used on classes shared with projects targeted for the web.

## Disposable

The `Disposable` interface allows implementing classes to define
behavior for cleaning up resources like IO streams, database
connections, as well as Observable and other event subscriptions.

When used with `@dandi/di-common`, `Disposable` instances are
automatically disposed by Dandi at the end of their lifecycle.

```typescript
class MyService implements Disposable {

constructor(private dbClient: DbClient) {}

public dispose(reason: string): void {
this.dbClient.release();
}

}
```

### Disposable Utilities

`Disposable` is also a static class provides several utility functions:

* **isDisposable(obj)** - Returns `true` if the object implements
`dispose()`; otherwise, `false`.

* **makeDisposable(obj, disposeFn)** - Modifies the specified object to
add the provided {@see DisposeFn} as the `Disposable.dispose`
implementation. If the object already has a function member named
`dispose`, it is wrapped and called before the new function.

* **use(obj, fn)** - Invokes the specified function in a `try`/`catch`,
statement, then `finally` disposes the object. Returns the value
returned by `fn`, or rethrows the error thrown by it.

* **useAsync(obj, fn)** - Same as `use`, but `fn` is invoked using `await`.

* **remapDisposed(target, reason)** - Overwrites members of the target
such that functions and property/field accessors throw an
`AlreadyDisposedError`, a read-only `disposed` property is set with
the value `true`, and the target is frozen (using `Object.freeze`) to
prevent further modification.
10 changes: 10 additions & 0 deletions common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export * from './src/app.error';
export * from './src/constructor';
export * from './src/disposable';
export * from './src/error.util';
export * from './src/metadata';
export * from './src/primitive';
export * from './src/type.helpers';
export * from './src/url';
export * from './src/uuid';
export { DateTime, Duration } from 'luxon';
3 changes: 3 additions & 0 deletions common/npm.link
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

# no deps
32 changes: 32 additions & 0 deletions common/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions di-core/package.json → common/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name": "@dandi/di-core",
"version": "1.0.0-alpha.12",
"scripts": {},
"name": "@dandi/common",
"version": "1.0.0-alpha.13",
"scripts": {
"postbuild": "cp src/url.* dist/src"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dandi-mvc/dandi.git"
Expand All @@ -11,16 +13,15 @@
"url": "https://github.com/dandi-mvc/dandi/issues"
},
"homepage": "https://github.com/dandi-mvc/dandi#readme",
"dependencies": {
"fs-extra": "^5.0.0"
"module": "index.js",
"peerDependencies": {
"luxon": "^1.3.0",
"uuid": "^3.2.1"
},
"devDependencies": {
"@types/fs-extra": "^5.0.2",
"@types/luxon": "^1.2.0",
"@types/node": "^9.6.17",
"luxon": "^1.2.1",
"luxon": "^1.3.0",
"uuid": "^3.2.1"
},
"peerDependencies": {
"@dandi/core": "1.0.0-alpha.12"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6542029

Please sign in to comment.