Skip to content

Commit 50bf5b2

Browse files
authored
Upstream release changes [0.14.0] (#297)
* docs: update `code-item` to `CodeGroupItem` Changes required for vuepressV2 upfrontjs/docs@946e50d * chore(deps-dev): update eslint * docs(services): removed typo * ci: refined api docs deployment * Feat/0.14.0 (#296) ## Feature: * feat(collection): add dot notation to pluck method * feat(collection): add `shuffle` method ## Chore: * chore: increment version * chore: make tsc output predictable * chore(deps-dev): update dependencies ## Refactor: * refactor(helpers): split out functions into files * This will help with maintainability and with tree-shaking when packaging separately for cjs. * refactor: import helper methods from their respective path ## Testing: * test: fix timestamp * test(api-calls): removed some casting * The values can already be inferred from the code * test(helpers): fix node@16 fringe testing error * Potentially issue due to different architecture on the runner. * https://github.com/upfrontjs/framework/actions/runs/3118093610/jobs/5057158718#step:5:59 * test(helpers): use real timers where possible * test(helpers): clarified comment
1 parent d33649a commit 50bf5b2

68 files changed

Lines changed: 1209 additions & 1050 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-api-docs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,18 @@ jobs:
2424
run: |
2525
git config --global user.email "nandor.kraszlan@gmail.com"
2626
git config --global user.name "Nandor Kraszlan"
27+
rm -rf types/
2728
cp -r ./api-docs/* ./
2829
git add -f assets
2930
git add -f classes
3031
git add -f interfaces
32+
git add -f functions
33+
git add -f types
3134
touch .nojekyll
3235
git add -f .nojekyll
3336
git add -f index.html
3437
git add -f modules.html
3538
git commit -m "Updates from ${{ github.ref }} - {{ github.sha }}" --no-verify
3639
git fetch
3740
git switch gh-pages
38-
git branch -r
3941
git push gh-pages

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# compiled output
22
api-docs
3-
index.*.js*
4-
array.*.js*
5-
string.*.js*
3+
index.*.*js*
4+
array.*.*js*
5+
string.*.*js*
66
types
77
*.tgz
8+
89
# in case gh-pages manually managed
910
index.html
1011
modules.html
1112
interfaces/
1213
classes/
1314
assets/
15+
functions/
1416
.nojekyll
1517

1618
# testing
Lines changed: 75 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,75 @@
1-
const sidebar = [
2-
{
3-
title: 'Prologue',
4-
children: [
5-
'/prologue/contributing',
6-
'/prologue/project-policies'
7-
]
8-
},
9-
{
10-
title: 'Getting Started',
11-
path: '/getting-started/',
12-
children: [
13-
'/getting-started/installation'
14-
]
15-
},
16-
{
17-
title: 'Calliope',
18-
path: '/calliope/',
19-
children: [
20-
'/calliope/attributes',
21-
'/calliope/api-calls',
22-
'/calliope/query-building',
23-
'/calliope/relationships',
24-
'/calliope/timestamps',
25-
'/calliope/model-collection'
26-
]
27-
},
28-
{
29-
title: 'Services',
30-
path: '/services/',
31-
children: [
32-
'/services/api',
33-
'/services/api-response-handler'
34-
]
35-
},
36-
{
37-
title: 'Helpers',
38-
path: '/helpers/',
39-
children: [
40-
'/helpers/collection',
41-
'/helpers/pagination',
42-
'/helpers/global-config',
43-
'/helpers/event-emitter'
44-
]
45-
},
46-
{
47-
title: 'Cookbook',
48-
path: '/cookbook'
49-
},
50-
{
51-
title: 'Testing',
52-
path: '/testing',
53-
children: [
54-
'/testing/factories'
55-
]
56-
},
57-
]
58-
59-
module.exports = {
60-
sidebar,
61-
nav: [
62-
{ text: 'API', link: 'https://upfrontjs.github.io/framework', target:'_blank' }
63-
]
64-
}
1+
import { SidebarConfig } from "vuepress";
2+
import { NavbarConfig } from "@vuepress/theme-default/lib/shared/nav";
3+
4+
const sidebar: SidebarConfig = [
5+
{
6+
text: 'Prologue',
7+
collapsible: true,
8+
children: [
9+
'/prologue/contributing',
10+
'/prologue/project-policies'
11+
]
12+
},
13+
{
14+
text: 'Getting Started',
15+
collapsible: true,
16+
children: [
17+
'/getting-started/',
18+
'/getting-started/installation'
19+
]
20+
},
21+
{
22+
text: 'Calliope',
23+
collapsible: true,
24+
children: [
25+
'/calliope/',
26+
'/calliope/attributes',
27+
'/calliope/api-calls',
28+
'/calliope/query-building',
29+
'/calliope/relationships',
30+
'/calliope/timestamps',
31+
'/calliope/model-collection'
32+
]
33+
},
34+
{
35+
text: 'Services',
36+
collapsible: true,
37+
children: [
38+
'/services/',
39+
'/services/api',
40+
'/services/api-response-handler'
41+
]
42+
},
43+
{
44+
text: 'Helpers',
45+
collapsible: true,
46+
children: [
47+
'/helpers/',
48+
'/helpers/collection',
49+
'/helpers/pagination',
50+
'/helpers/global-config',
51+
'/helpers/event-emitter'
52+
]
53+
},
54+
{
55+
text: 'Testing',
56+
collapsible: true,
57+
children: [
58+
'/testing/',
59+
'/testing/factories'
60+
]
61+
},
62+
{
63+
text: 'Cookbook',
64+
link: '/cookbook'
65+
},
66+
]
67+
68+
const navbar: NavbarConfig = [
69+
{ text: 'API', link: 'https://upfrontjs.github.io/framework', target:'_blank' }
70+
]
71+
72+
export default {
73+
sidebar,
74+
navbar
75+
}

docs/calliope/attributes.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Models have been given powerful tools to manage data without involved logic and
1313
Casting transforms values when accessing or setting attributes on a model.
1414
To define the casters on your model you should define a getter for the `casts` property.
1515

16-
<code-group>
17-
<code-block title="Javascript">
16+
<CodeGroup>
17+
<CodeGroupItem title="Javascript">
1818
```js
1919
// User.js
2020
import { Model } from '@upfrontjs/framework';
@@ -27,9 +27,9 @@ export default class User extends Model {
2727
}
2828
}
2929
```
30-
</code-block>
30+
</CodeGroupItem>
3131

32-
<code-block title="Typescript">
32+
<CodeGroupItem title="Typescript">
3333
```ts
3434
// User.ts
3535
import { Model } from '@upfrontjs/framework';
@@ -44,8 +44,8 @@ export default class User extends Model {
4444
}
4545
}
4646
```
47-
</code-block>
48-
</code-group>
47+
</CodeGroupItem>
48+
</CodeGroup>
4949

5050
**The following cast types are available:**
5151

@@ -72,8 +72,8 @@ Cast the values to the [given date time](../helpers/global-config.md#datetime) b
7272

7373
This is an object which implements the `AttributeCaster` type. Meaning it has a `get` and a `set` method both of which accepts a value, and an `Attributes` object (the equivalent of [getRawAttributes](#getrawattributes)) argument.
7474

75-
<code-group>
76-
<code-block title="Javascript">
75+
<CodeGroup>
76+
<CodeGroupItem title="Javascript">
7777
```js
7878
// User.js
7979
import { Model } from '@upfrontjs/framework';
@@ -93,9 +93,9 @@ export default class User extends Model {
9393
}
9494
}
9595
```
96-
</code-block>
96+
</CodeGroupItem>
9797

98-
<code-block title="Typescript">
98+
<CodeGroupItem title="Typescript">
9999
```ts
100100
// User.ts
101101
import { Model } from '@upfrontjs/framework';
@@ -116,8 +116,8 @@ export default class User extends Model {
116116
}
117117
}
118118
```
119-
</code-block>
120-
</code-group>
119+
</CodeGroupItem>
120+
</CodeGroup>
121121

122122
### Further casting methods
123123

@@ -328,8 +328,8 @@ user.fullName; // 'Dr. John Doe'
328328

329329
While some prefer to name their variables and object keys as [camelCase](../helpers/readme.md#camel) others will prefer [snake_case](../helpers/readme.md#snake) or perhaps there are different conventions between the front and back end. To accommodate such preferences you can set the `attributeCasing` getter to return either `'camel'` or `'snake'` like so:
330330

331-
<code-group>
332-
<code-block title="Javascript">
331+
<CodeGroup>
332+
<CodeGroupItem title="Javascript">
333333

334334
```js
335335
// User.js
@@ -341,9 +341,9 @@ export default class User extends Model {
341341
}
342342
}
343343
```
344-
</code-block>
344+
</CodeGroupItem>
345345

346-
<code-block title="Typescript">
346+
<CodeGroupItem title="Typescript">
347347

348348
```ts
349349
// User.ts
@@ -355,8 +355,8 @@ export default class User extends Model {
355355
}
356356
}
357357
```
358-
</code-block>
359-
</code-group>
358+
</CodeGroupItem>
359+
</CodeGroup>
360360

361361
When using mass-assignment like the [create](./readme.md#create) and the [fill](#fill) methods, all keys of the given arguments will automatically and recursively transform to the set casing. e.g.: `user.fill({ some_value: 1 }).someValue; // 1`
362362
The default value is `'camel'`. This can be counteracted by the [serverAttributeCasing](./api-calls.md#serverattributecasing) getter method when sending data to the server.

docs/calliope/readme.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ The model is at the hearth of this package. It boasts a lot of features, so they
1212

1313
To create a model, you should first define your model class and define the [getName](#getname) method:
1414

15-
<code-group>
15+
<CodeGroup>
1616

17-
<code-block title="Javascript">
17+
<CodeGroupItem title="Javascript">
1818

1919
```js
2020
// User.js
@@ -26,9 +26,9 @@ export default class User extends Model {
2626
}
2727
}
2828
```
29-
</code-block>
29+
</CodeGroupItem>
3030

31-
<code-block title="Typescript">
31+
<CodeGroupItem title="Typescript">
3232

3333
```ts
3434
// User.ts
@@ -40,9 +40,9 @@ export default class User extends Model {
4040
}
4141
}
4242
```
43-
</code-block>
43+
</CodeGroupItem>
4444

45-
</code-group>
45+
</CodeGroup>
4646

4747
Then you can call your model in various way, for example
4848
```js

docs/cookbook.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ In the documentation simple and concise examples are favoured to avoid too much
1818
#### Extend the collections to fit your needs.
1919
Don't be afraid of changing and overriding methods if that solves your problem. The aim is to make development a breeze.
2020

21-
<code-group>
21+
<CodeGroup>
2222

23-
<code-block title="Javascript">
23+
<CodeGroupItem title="Javascript">
2424

2525
```js
2626
// UserCollection.js
@@ -52,9 +52,9 @@ if (users.areAwake().length === modelCollection.length) {
5252
console.log('Oh no, somebody\'s not ready yet!');
5353
}
5454
```
55-
</code-block>
55+
</CodeGroupItem>
5656

57-
<code-block title="Typescript">
57+
<CodeGroupItem title="Typescript">
5858

5959
```ts
6060
// UserCollection.ts
@@ -86,9 +86,9 @@ if (users.areAwake().length === modelCollection.length) {
8686
console.log('Oh no, somebody\'s not ready yet!');
8787
}
8888
```
89-
</code-block>
89+
</CodeGroupItem>
9090

91-
</code-group>
91+
</CodeGroup>
9292

9393
---
9494

docs/getting-started/installation.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Installation
22

3-
<code-group>
4-
<code-block title="npm">
3+
<CodeGroup>
4+
<CodeGroupItem title="npm">
55
```shell
66
npm install @upfrontjs/framework
77
```
8-
</code-block>
8+
</CodeGroupItem>
99

10-
<code-block title="yarn">
10+
<CodeGroupItem title="yarn">
1111
```shell
1212
yarn install @upfrontjs/framework
1313
```
14-
</code-block>
15-
</code-group>
14+
</CodeGroupItem>
15+
</CodeGroup>
1616

1717
The library is transpiled to ES6 (currently the lowest supported version), but if you're using [Typescript](https://www.typescriptlang.org/), you could choose to use the source `.ts` files. To do so, import files from `/src` folder as opposed to the library root.
1818
```js

0 commit comments

Comments
 (0)