Skip to content

Commit 72872c5

Browse files
authored
Merge pull request #116 from nitrictech/develop
Release
2 parents 1a3d340 + 4d25ea3 commit 72872c5

File tree

23 files changed

+415
-57
lines changed

23 files changed

+415
-57
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug encountered while using nitric
4+
labels: bug
5+
---
6+
7+
**Describe the bug**
8+
<!--
9+
A clear and concise description of what the bug is. What happened?
10+
-->
11+
12+
**Expected behavior**
13+
14+
<!--
15+
A clear and concise description of what you expected to happen.
16+
-->
17+
18+
**To Reproduce**
19+
20+
Steps to reproduce the behavior:
21+
22+
<!--
23+
1. Go to '...'
24+
2. Click on '....'
25+
3. Scroll down to '....'
26+
4. See error
27+
-->
28+
29+
**Output of `nitric info -o yaml`:**
30+
31+
<!--
32+
(paste your output here)
33+
-->
34+
35+
**Brief description of your project**
36+
37+
<!--
38+
What are you building with Nitric?
39+
-->
40+
41+
**Additional context**
42+
43+
<!--
44+
Add any other context about the problem here.
45+
-->
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: Enhancement Request
3+
about: Suggest an enhancement to nitric
4+
labels: enhancement
5+
6+
---
7+
8+
**Describe the solution you'd like**
9+
<!--
10+
A clear and concise description of what you want to be added.
11+
-->
12+
13+
**Why is this needed? What challenge will it help you solve? Please describe.**
14+
<!--
15+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
16+
-->
17+
18+
**Describe alternatives you've considered**
19+
<!--
20+
A clear and concise description of any alternative solutions or features you've considered.
21+
-->
22+
23+
**Output of `nitric info -o yaml`:**
24+
25+
<!--
26+
(paste your output here)
27+
-->
28+
29+
**Brief description of your project**
30+
<!--
31+
What are you building with Nitric?
32+
-->
33+
34+
**Additional context**
35+
<!--
36+
Add any other context or screenshots about the feature request here.
37+
-->

.github/workflows/test.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ jobs:
1212
steps:
1313
- name: Checkout
1414
uses: actions/checkout@v2
15-
with:
16-
token: ${{secrets.SUB_MODULE_PAT}}
17-
submodules: recursive
1815
- name: Cache Yarn Cache
1916
uses: actions/cache@v2
2017
with:

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,26 @@
88
[![Version](https://img.shields.io/npm/v/@nitric/sdk.svg)](https://npmjs.org/package/@nitric/sdk)
99
[![Downloads/week](https://img.shields.io/npm/dw/@nitric/sdk.svg)](https://npmjs.org/package/@nitric/sdk)
1010

11-
# @nitric/sdk
12-
The NodeJS SDK supports the use of the cloud-portable [Nitric](https://nitric.io) framework with NodeJS 12+.
13-
> The SDK is in early stage development and APIs and interfaces are still subject to breaking changes
11+
# Node SDK for Nitric
1412

15-
## Prerequisites
16-
- NodeJS 12+
13+
The NodeJS SDK supports the use of the Nitric framework with NodeJS 12+. For more information, check out the main [Nitric repo](https://github.com/nitrictech/nitric).
1714

18-
## Getting Started
15+
Nitric SDKs provide an infrastructure-as-code style that lets you define resources in code. You can also write the functions that support the logic behind APIs, subscribers and schedules.
1916

20-
Checkout the [nitric docs](https://nitric.io/docs) to see how to get started using nitric
17+
You can request the type of access you need to resources such as publishing for topics, without dealing directly with IAM or policy documents.
2118

19+
## Status
20+
21+
The SDK is in early stage development and APIs and interfaces are still subject to breaking changes. We’d love your feedback as we build additional functionality!
22+
23+
## Get in touch:
24+
25+
- Ask questions in [GitHub discussions](https://github.com/nitrictech/nitric/discussions)
26+
27+
- Find us on [Twitter](https://twitter.com/nitric_io)
28+
29+
- Send us an [email](mailto:maintainers@nitric.io)
30+
31+
## Get Started
32+
33+
Check out the [Nitric docs](https://nitric.io/docs) to see how to get started using Nitric.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"David Moore <david.moore@nitric.io>"
2727
],
2828
"dependencies": {
29-
"@grpc/grpc-js": "^1.1.7",
30-
"@nitric/api": "^0.13.0",
29+
"@grpc/grpc-js": "^1.5.9",
30+
"@nitric/api": "0.15.0",
3131
"common-tags": "^1.8.0",
3232
"google-protobuf": "3.14.0",
3333
"path-parser": "^6.1.0",

src/api/documents/v0/collection-group-ref.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { DocumentServiceClient } from '@nitric/api/proto/document/v1/document_gr
1515
import { InvalidArgumentError } from '../../errors';
1616
import { CollectionRef } from './collection-ref';
1717
import { MAX_COLLECTION_DEPTH } from './constants';
18-
import { DocumentRef } from './document-ref';
18+
import { DocumentRef, DocumentStructure } from './document-ref';
1919
import { Query } from './query';
2020

2121
const NIL_DOC_ID = '';
@@ -25,7 +25,7 @@ const NIL_DOC_ID = '';
2525
*
2626
* Provides a Document API CollectionGroupRef class.
2727
*/
28-
export class CollectionGroupRef<T extends { [key: string]: any }> {
28+
export class CollectionGroupRef<T extends DocumentStructure> {
2929
private documentClient: DocumentServiceClient;
3030
public readonly parent: CollectionGroupRef<any>;
3131
public readonly name: string;
@@ -44,7 +44,7 @@ export class CollectionGroupRef<T extends { [key: string]: any }> {
4444
* Create a CollectionGroupRef referencing a sub-collection of this collection
4545
* @param name
4646
*/
47-
public collection<T extends { [key: string]: any }>(
47+
public collection<T extends DocumentStructure>(
4848
name: string
4949
): CollectionGroupRef<T> {
5050
if (this.depth() >= MAX_COLLECTION_DEPTH) {

src/api/documents/v0/collection-ref.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
import { Collection } from '@nitric/api/proto/document/v1/document_pb';
1515
import { DocumentServiceClient } from '@nitric/api/proto/document/v1/document_grpc_pb';
1616
import { Query } from './query';
17-
import { DocumentRef } from './document-ref';
17+
import { DocumentRef, DocumentStructure } from './document-ref';
1818
import { CollectionGroupRef } from './collection-group-ref';
1919

2020
/**
2121
* CollectionRef
2222
*
2323
* Provides a Document API CollectionRef class.
2424
*/
25-
export class CollectionRef<T extends { [key: string]: any }> {
25+
export class CollectionRef<T extends DocumentStructure> {
2626
private documentClient: DocumentServiceClient;
2727
public readonly name: string;
2828
public readonly parent?: DocumentRef<any>;

src/api/documents/v0/document-ref.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ import { fromGrpcError, InvalidArgumentError } from '../../errors';
2424
import { CollectionRef } from './collection-ref';
2525
import { MAX_COLLECTION_DEPTH } from './constants';
2626

27+
export type DocumentStructure = Record<string, any>;
28+
2729
/**
2830
* Document Ref
2931
*
3032
* Provides a Document Reference class.
3133
* Used to create references to collections.
3234
*/
33-
export class DocumentRef<T extends { [key: string]: any }> {
35+
export class DocumentRef<T extends DocumentStructure> {
3436
private documentClient: DocumentServiceClient;
3537
public readonly parent: CollectionRef<T>;
3638
public readonly id: string;
@@ -112,14 +114,10 @@ export class DocumentRef<T extends { [key: string]: any }> {
112114
});
113115
}
114116

115-
/**
116-
*
117-
*/
118117
private toWire(): Key {
119118
const key = new Key();
120119
key.setCollection(this.parent["toWire"]());
121120
key.setId(this.id);
122-
123121
return key;
124122
}
125123

@@ -138,7 +136,7 @@ export class DocumentRef<T extends { [key: string]: any }> {
138136
* @param name The name of the collection (required)
139137
* @returns The Collection instance
140138
*/
141-
public collection<T extends { [key: string]: any }>(
139+
public collection<T extends DocumentStructure>(
142140
name: string
143141
): CollectionRef<T> {
144142
if (this.depth() >= MAX_COLLECTION_DEPTH) {

src/api/documents/v0/document-snapshot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
import { DocumentRef } from './document-ref';
14+
import { DocumentRef, DocumentStructure } from './document-ref';
1515

16-
export class DocumentSnapshot<T> {
16+
export class DocumentSnapshot<T extends DocumentStructure> {
1717
public readonly ref: DocumentRef<T>;
1818
public readonly content: T;
1919

src/api/documents/v0/documents.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { SERVICE_BIND } from '../../../constants';
1515
import { DocumentServiceClient } from '@nitric/api/proto/document/v1/document_grpc_pb';
1616
import * as grpc from '@grpc/grpc-js';
1717
import { CollectionRef } from './collection-ref';
18+
import { DocumentStructure } from './document-ref';
1819

1920
/**
2021
* Documents
@@ -37,7 +38,7 @@ export class Documents {
3738
* @param name The name of the collection (required)
3839
* @returns The Collection instance
3940
*/
40-
public collection<T extends { [key: string]: any }>(name: string) {
41+
public collection<T extends DocumentStructure>(name: string) {
4142
return new CollectionRef<T>(this.documentClient, name);
4243
}
4344
}

0 commit comments

Comments
 (0)