@baeta/util-path 0.1.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @baeta/util-path
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#165](https://github.com/andreisergiu98/baeta/pull/165) [`1334c2a`](https://github.com/andreisergiu98/baeta/commit/1334c2a866676c88f0f3d380b22133d81c4e98bc) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - mark as stable
8
+
9
+ ### Patch Changes
10
+
11
+ - [#189](https://github.com/andreisergiu98/baeta/pull/189) [`d500378`](https://github.com/andreisergiu98/baeta/commit/d500378198e0a9c48298c4242913bca8ad348228) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add jsdocs
12
+
13
+ ## 0.1.4
14
+
15
+ ### Patch Changes
16
+
17
+ - [`b59db50`](https://github.com/andreisergiu98/baeta/commit/b59db501a83275ab2d964933080e688a3a5d8820) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add readme
18
+
3
19
  ## 0.1.3
4
20
 
5
21
  ### Patch Changes
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Pampu Andrei
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,139 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/andreisergiu98/baeta/refs/heads/main/website/static/img/logo-baeta.svg" alt="Baeta Logo" width="150"/>
3
+ </p>
4
+
5
+ <div align="center">
6
+ <h1>Baeta</h1>
7
+ <a href="https://www.npmjs.com/package/@baeta/cli"><img src="https://img.shields.io/npm/v/@baeta/cli.svg?style=flat" /></a>
8
+ <a href="https://github.com/andreisergiu98/baeta/actions/workflows/testing.yml"><img src="https://img.shields.io/github/actions/workflow/status/andreisergiu98/baeta/testing.yml" /></a>
9
+ <a href="https://github.com/andreisergiu98/baeta/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" /></a>
10
+ <a href="https://github.com/andreisergiu98/baeta/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" /></a>
11
+ <br />
12
+ <br />
13
+ <a href="https://baeta.io/docs/getting-started/installation">Getting Started</a>
14
+ <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
15
+ <a href="https://www.baeta.io/">Website</a>
16
+ <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
17
+ <a href="https://baeta.io/docs/intro">Docs</a>
18
+ <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
19
+ <a href="https://github.com/andreisergiu98/baeta/tree/main/examples">Examples</a>
20
+ <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
21
+ <a href="https://discord.gg/BHFXHvyj">Discord</a>
22
+ <br />
23
+ <hr />
24
+ </div>
25
+
26
+ # What is Baeta?
27
+
28
+ Building GraphQL APIs shouldn't be complicated. **Baeta** is a modern, modular, open-source GraphQL framework designed with flexibility in mind. It follows a granular approach where you only add what you need, helping developers focus on what matters most - creating powerful, scalable APIs without the boilerplate.
29
+
30
+ ### Key Features
31
+
32
+ - **Modular Architecture**: Organize your API into manageable modules
33
+ - **Schema-First Development**: Define your API contract upfront
34
+ - **Type Safety**: Automatic code generation for type-safe development
35
+ - **Middleware & Directives**: Easy integration of custom behaviors
36
+ - **High Performance**: Built for scalability and efficiency
37
+
38
+ #### And optional extensions and plugins
39
+
40
+ - **@baeta/extension-auth**: Add powerful scope-based authorization
41
+ - **@baeta/extension-cache**: Implement automatic caching with simple update patterns
42
+ - ... and more!
43
+
44
+ ## Why use Baeta?
45
+
46
+ Baeta makes it easy to build better GraphQL APIs while staying flexible. Here's how:
47
+
48
+ **Granular and Progressive:** Start small and add features as you need them. Whether you're building a simple API or a complex system, Baeta scales with your needs.
49
+
50
+ **Modular architecture:** Baeta's modular design allows you to organize your GraphQL API into smaller, more manageable modules that can be added or removed as needed. This makes it easier to maintain and scale your API over time.
51
+
52
+ **Schema-first approach:** With Baeta, you define your schema first, and then logic and resolvers. This approach ensures a consistent and well-defined API for your clients and reduces boilerplate code.
53
+
54
+ ## How it Works
55
+
56
+ #### 1. Define your schema
57
+
58
+ ```graphql
59
+ type User {
60
+ id: ID!
61
+ name: String!
62
+ email: String!
63
+ age: Int
64
+ }
65
+
66
+ input UserWhereUnique {
67
+ id: ID
68
+ email: String
69
+ }
70
+
71
+ type Query {
72
+ user(where: UserWhereUnique!): User!
73
+ users: [User!]!
74
+ }
75
+ ```
76
+
77
+ #### 2. Implement your resolvers
78
+
79
+ ```typescript
80
+ import { getUserModule } from "./typedef";
81
+
82
+ const { Query } = getUserModule();
83
+
84
+ Query.user(({ args }) => {
85
+ return dataSource.user.find(args.where);
86
+ });
87
+
88
+ Query.users(() => {
89
+ return dataSource.user.findMany();
90
+ });
91
+ ```
92
+
93
+ #### 3. Add authorization
94
+
95
+ ```typescript
96
+ const { Query, Mutation } = getUserModule();
97
+
98
+ Query.users.$auth({
99
+ $or: {
100
+ isPublic: true,
101
+ isLoggedIn: true,
102
+ },
103
+ });
104
+ ```
105
+
106
+ #### 4. Add caching
107
+
108
+ ```typescript
109
+ import { getUserModule } from "./typedef";
110
+
111
+ const { User, Query } = getUserModule();
112
+
113
+ export const userCache = User.$createCache();
114
+
115
+ Query.user.$useCache(userCache);
116
+ Query.users.$useCache(userCache);
117
+ ```
118
+
119
+ ## Compatibility
120
+
121
+ Baeta is compatible with all GraphQL servers, which makes it easy to integrate with your existing stack. It works seamlessly with popular GraphQL server libraries such as **Graphql Yoga** and **Apollo Server**, as well as other popular tools like **Prisma**, **Drizzle** and **Kysely**.
122
+
123
+ Baeta's development tools are built for Node.js, but the runtime code is environment-agnostic. This means your Baeta applications can run anywhere JavaScript runs, including:
124
+
125
+ - Deno
126
+ - Cloudflare Workers
127
+ - AWS Lambda
128
+ - Vercel Edge Functions
129
+ - Bun
130
+ - Node.js
131
+ - Any other JavaScript runtime
132
+
133
+ ## Credits
134
+
135
+ Baeta was inspired by several amazing projects and people in the GraphQL ecosystem. Check out our [Credits page](https://baeta.io/docs/credits) to learn more about the individuals and projects that influenced Baeta's development.
136
+
137
+ ## License
138
+
139
+ Baeta is licensed under the [MIT License](./LICENSE).
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ParsedPath } from 'node:path';
1
2
  import upath from 'upath';
2
3
 
3
4
  declare function posixPath(pathname: string): string;
@@ -9,17 +10,35 @@ declare const defaultExt: typeof upath.defaultExt;
9
10
  declare const delimiter: string;
10
11
  declare const dirname: typeof upath.dirname;
11
12
  declare const extname: typeof upath.extname;
12
- declare const format: typeof upath.format;
13
+ /**
14
+ * Returns a path string from an object - the opposite of parse().
15
+ *
16
+ * @param pathObject path to evaluate.
17
+ */
18
+ declare const format: (pathObject: ParsedPath) => string;
13
19
  declare const isAbsolute: typeof upath.isAbsolute;
14
20
  declare const join: typeof upath.join;
15
- declare const joinSafe: typeof upath.joinSafe;
21
+ /**
22
+ * Exactly like path.join(), but it keeps the first meaningful ./.
23
+ *
24
+ * Note that the unix / is returned everywhere, so windows \ is always converted to unix /.
25
+ *
26
+ * @param paths string paths to join
27
+ */
28
+ declare const joinSafe: (...paths: any[]) => string;
16
29
  declare const normalize: typeof upath.normalize;
17
30
  declare const normalizeSafe: typeof upath.normalizeSafe;
18
31
  declare const normalizeTrim: typeof upath.normalizeTrim;
19
32
  declare const parse: typeof upath.parse;
20
33
  declare const posix: typeof upath.posix;
21
34
  declare const relative: typeof upath.relative;
22
- declare const removeExt: typeof upath.removeExt;
35
+ /**
36
+ * Removes the specific ext extension from filename, if it has it. Otherwise it leaves it as is. As in all upath functions, it be .ext or ext.
37
+ *
38
+ * @param filename string filename to remove extension to
39
+ * @param ext string extension to remove
40
+ */
41
+ declare const removeExt: (filename: string, ext: string) => string;
23
42
  declare const resolve: typeof upath.resolve;
24
43
  declare const sep: string;
25
44
  declare const toUnix: typeof upath.toUnix;
@@ -33,17 +52,17 @@ declare const _default: {
33
52
  delimiter: string;
34
53
  dirname: typeof upath.dirname;
35
54
  extname: typeof upath.extname;
36
- format: typeof upath.format;
55
+ format: (pathObject: ParsedPath) => string;
37
56
  isAbsolute: typeof upath.isAbsolute;
38
57
  join: typeof upath.join;
39
- joinSafe: typeof upath.joinSafe;
58
+ joinSafe: (...paths: any[]) => string;
40
59
  normalize: typeof upath.normalize;
41
60
  normalizeSafe: typeof upath.normalizeSafe;
42
61
  normalizeTrim: typeof upath.normalizeTrim;
43
62
  parse: typeof upath.parse;
44
63
  posix: typeof upath.posix;
45
64
  relative: typeof upath.relative;
46
- removeExt: typeof upath.removeExt;
65
+ removeExt: (filename: string, ext: string) => string;
47
66
  resolve: typeof upath.resolve;
48
67
  sep: string;
49
68
  toUnix: typeof upath.toUnix;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../index.ts"],"sourcesContent":["import path from 'node:path';\nimport upath from 'upath';\n\nexport function posixPath(pathname: string) {\n\treturn pathname.split(path.win32.sep).join(path.posix.sep);\n}\n\nexport function winPath(pathname: string) {\n\treturn pathname.split(path.posix.sep).join(path.win32.sep);\n}\n\nexport const addExt = upath.addExt;\nexport const basename = upath.basename;\nexport const changeExt = upath.changeExt;\nexport const defaultExt = upath.defaultExt;\nexport const delimiter = upath.delimiter;\nexport const dirname = upath.dirname;\nexport const extname = upath.extname;\nexport const format = upath.format;\nexport const isAbsolute = upath.isAbsolute;\nexport const join = upath.join;\nexport const joinSafe = upath.joinSafe;\nexport const normalize = upath.normalize;\nexport const normalizeSafe = upath.normalizeSafe;\nexport const normalizeTrim = upath.normalizeTrim;\nexport const parse = upath.parse;\nexport const posix = upath.posix;\nexport const relative = upath.relative;\nexport const removeExt = upath.removeExt;\nexport const resolve = upath.resolve;\nexport const sep = upath.sep;\nexport const toUnix = upath.toUnix;\nexport const trimExt = upath.trimExt;\nexport const win32 = upath.win32;\n\nexport default {\n\taddExt,\n\tbasename,\n\tchangeExt,\n\tdefaultExt,\n\tdelimiter,\n\tdirname,\n\textname,\n\tformat,\n\tisAbsolute,\n\tjoin,\n\tjoinSafe,\n\tnormalize,\n\tnormalizeSafe,\n\tnormalizeTrim,\n\tparse,\n\tposix,\n\trelative,\n\tremoveExt,\n\tresolve,\n\tsep,\n\ttoUnix,\n\ttrimExt,\n\twin32,\n\tposixPath,\n\twinPath,\n};\n"],"mappings":";AAAA,OAAO,UAAU;AACjB,OAAO,WAAW;AAEX,SAAS,UAAU,UAAkB;AAC3C,SAAO,SAAS,MAAM,KAAK,MAAM,GAAG,EAAE,KAAK,KAAK,MAAM,GAAG;AAC1D;AAEO,SAAS,QAAQ,UAAkB;AACzC,SAAO,SAAS,MAAM,KAAK,MAAM,GAAG,EAAE,KAAK,KAAK,MAAM,GAAG;AAC1D;AAEO,IAAM,SAAS,MAAM;AACrB,IAAM,WAAW,MAAM;AACvB,IAAM,YAAY,MAAM;AACxB,IAAM,aAAa,MAAM;AACzB,IAAM,YAAY,MAAM;AACxB,IAAM,UAAU,MAAM;AACtB,IAAM,UAAU,MAAM;AACtB,IAAM,SAAS,MAAM;AACrB,IAAM,aAAa,MAAM;AACzB,IAAM,OAAO,MAAM;AACnB,IAAM,WAAW,MAAM;AACvB,IAAM,YAAY,MAAM;AACxB,IAAM,gBAAgB,MAAM;AAC5B,IAAM,gBAAgB,MAAM;AAC5B,IAAM,QAAQ,MAAM;AACpB,IAAM,QAAQ,MAAM;AACpB,IAAM,WAAW,MAAM;AACvB,IAAM,YAAY,MAAM;AACxB,IAAM,UAAU,MAAM;AACtB,IAAM,MAAM,MAAM;AAClB,IAAM,SAAS,MAAM;AACrB,IAAM,UAAU,MAAM;AACtB,IAAM,QAAQ,MAAM;AAE3B,IAAO,oBAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;","names":[]}
1
+ {"version":3,"sources":["../index.ts"],"sourcesContent":["import path, { type ParsedPath } from 'node:path';\nimport upath from 'upath';\n\nexport function posixPath(pathname: string) {\n\treturn pathname.split(path.win32.sep).join(path.posix.sep);\n}\n\nexport function winPath(pathname: string) {\n\treturn pathname.split(path.posix.sep).join(path.win32.sep);\n}\n\nexport const addExt = upath.addExt;\nexport const basename = upath.basename;\nexport const changeExt = upath.changeExt;\nexport const defaultExt = upath.defaultExt;\nexport const delimiter = upath.delimiter;\nexport const dirname = upath.dirname;\nexport const extname = upath.extname;\n\n/**\n * Returns a path string from an object - the opposite of parse().\n *\n * @param pathObject path to evaluate.\n */\nexport const format = upath.format as (pathObject: ParsedPath) => string;\n\nexport const isAbsolute = upath.isAbsolute;\nexport const join = upath.join;\n\n/**\n * Exactly like path.join(), but it keeps the first meaningful ./.\n *\n * Note that the unix / is returned everywhere, so windows \\ is always converted to unix /.\n *\n * @param paths string paths to join\n */\n// biome-ignore lint/suspicious/noExplicitAny: accept any arguments\nexport const joinSafe = upath.joinSafe as (...paths: any[]) => string;\n\nexport const normalize = upath.normalize;\nexport const normalizeSafe = upath.normalizeSafe;\nexport const normalizeTrim = upath.normalizeTrim;\nexport const parse = upath.parse;\nexport const posix = upath.posix;\nexport const relative = upath.relative;\n\n/**\n * Removes the specific ext extension from filename, if it has it. Otherwise it leaves it as is. As in all upath functions, it be .ext or ext.\n *\n * @param filename string filename to remove extension to\n * @param ext string extension to remove\n */\nexport const removeExt = upath.removeExt as (filename: string, ext: string) => string;\n\nexport const resolve = upath.resolve;\nexport const sep = upath.sep;\nexport const toUnix = upath.toUnix;\nexport const trimExt = upath.trimExt;\nexport const win32 = upath.win32;\n\nexport default {\n\taddExt,\n\tbasename,\n\tchangeExt,\n\tdefaultExt,\n\tdelimiter,\n\tdirname,\n\textname,\n\tformat,\n\tisAbsolute,\n\tjoin,\n\tjoinSafe,\n\tnormalize,\n\tnormalizeSafe,\n\tnormalizeTrim,\n\tparse,\n\tposix,\n\trelative,\n\tremoveExt,\n\tresolve,\n\tsep,\n\ttoUnix,\n\ttrimExt,\n\twin32,\n\tposixPath,\n\twinPath,\n};\n"],"mappings":";AAAA,OAAO,UAA+B;AACtC,OAAO,WAAW;AAEX,SAAS,UAAU,UAAkB;AAC3C,SAAO,SAAS,MAAM,KAAK,MAAM,GAAG,EAAE,KAAK,KAAK,MAAM,GAAG;AAC1D;AAEO,SAAS,QAAQ,UAAkB;AACzC,SAAO,SAAS,MAAM,KAAK,MAAM,GAAG,EAAE,KAAK,KAAK,MAAM,GAAG;AAC1D;AAEO,IAAM,SAAS,MAAM;AACrB,IAAM,WAAW,MAAM;AACvB,IAAM,YAAY,MAAM;AACxB,IAAM,aAAa,MAAM;AACzB,IAAM,YAAY,MAAM;AACxB,IAAM,UAAU,MAAM;AACtB,IAAM,UAAU,MAAM;AAOtB,IAAM,SAAS,MAAM;AAErB,IAAM,aAAa,MAAM;AACzB,IAAM,OAAO,MAAM;AAUnB,IAAM,WAAW,MAAM;AAEvB,IAAM,YAAY,MAAM;AACxB,IAAM,gBAAgB,MAAM;AAC5B,IAAM,gBAAgB,MAAM;AAC5B,IAAM,QAAQ,MAAM;AACpB,IAAM,QAAQ,MAAM;AACpB,IAAM,WAAW,MAAM;AAQvB,IAAM,YAAY,MAAM;AAExB,IAAM,UAAU,MAAM;AACtB,IAAM,MAAM,MAAM;AAClB,IAAM,SAAS,MAAM;AACrB,IAAM,UAAU,MAAM;AACtB,IAAM,QAAQ,MAAM;AAE3B,IAAO,oBAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baeta/util-path",
3
- "version": "0.1.3",
3
+ "version": "1.0.0",
4
4
  "keywords": [
5
5
  "baeta",
6
6
  "graphql",
@@ -79,6 +79,12 @@
79
79
  "./index.ts"
80
80
  ],
81
81
  "readme": "none",
82
- "tsconfig": "./tsconfig.json"
82
+ "tsconfig": "./tsconfig.json",
83
+ "sort": [
84
+ "kind",
85
+ "instance-first",
86
+ "required-first",
87
+ "alphabetical-ignoring-documents"
88
+ ]
83
89
  }
84
90
  }