@kubun/scalars 0.4.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/LICENSE.md ADDED
@@ -0,0 +1,57 @@
1
+ # The Prosperity Public License 3.0.0
2
+
3
+ Contributor: Paul Le Cam
4
+
5
+ Source Code: https://github.com/PaulLeCam/kubun
6
+
7
+ ## Purpose
8
+
9
+ This license allows you to use and share this software for noncommercial purposes for free and to try this software for commercial purposes for thirty days.
10
+
11
+ ## Agreement
12
+
13
+ In order to receive this license, you have to agree to its rules. Those rules are both obligations under that agreement and conditions to your license. Don't do anything with this software that triggers a rule you can't or won't follow.
14
+
15
+ ## Notices
16
+
17
+ Make sure everyone who gets a copy of any part of this software from you, with or without changes, also gets the text of this license and the contributor and source code lines above.
18
+
19
+ ## Commercial Trial
20
+
21
+ Limit your use of this software for commercial purposes to a thirty-day trial period. If you use this software for work, your company gets one trial period for all personnel, not one trial per person.
22
+
23
+ ## Contributions Back
24
+
25
+ Developing feedback, changes, or additions that you contribute back to the contributor on the terms of a standardized public software license such as [the Blue Oak Model License 1.0.0](https://blueoakcouncil.org/license/1.0.0), [the Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html), [the MIT license](https://spdx.org/licenses/MIT.html), or [the two-clause BSD license](https://spdx.org/licenses/BSD-2-Clause.html) doesn't count as use for a commercial purpose.
26
+
27
+ ## Personal Uses
28
+
29
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, doesn't count as use for a commercial purpose.
30
+
31
+ ## Noncommercial Organizations
32
+
33
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution doesn't count as use for a commercial purpose regardless of the source of funding or obligations resulting from the funding.
34
+
35
+ ## Defense
36
+
37
+ Don't make any legal claim against anyone accusing this software, with or without changes, alone or with other technology, of infringing any patent.
38
+
39
+ ## Copyright
40
+
41
+ The contributor licenses you to do everything with this software that would otherwise infringe their copyright in it.
42
+
43
+ ## Patent
44
+
45
+ The contributor licenses you to do everything with this software that would otherwise infringe any patents they can license or become able to license.
46
+
47
+ ## Reliability
48
+
49
+ The contributor can't revoke this license.
50
+
51
+ ## Excuse
52
+
53
+ You're excused for unknowingly breaking [Notices](#notices) if you take all practical steps to comply within thirty days of learning you broke the rule.
54
+
55
+ ## No Liability
56
+
57
+ ***As far as the law allows, this software comes as is, without any warranty or condition, and the contributor won't be liable to anyone for any damages related to this software or this license, under any kind of legal claim.***
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # Kubun scalars
2
+
3
+ ## Installation
4
+
5
+ ```sh
6
+ npm install @kubun/scalars
7
+ ```
8
+
9
+ ## License
10
+
11
+ [Prosperity Public License 3.0.0](LICENSE.md)
package/lib/index.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import type { JSONSchema } from 'json-schema-typed';
2
+ export declare const attachmentIDSchema: JSONSchema.String;
3
+ export declare const docIDSchema: JSONSchema.String;
4
+ export declare const bigIntSchema: JSONSchema.Integer;
5
+ export declare const didSchema: JSONSchema.String;
6
+ export declare const dateTimeSchema: JSONSchema.String;
7
+ export declare const durationSchema: JSONSchema.String;
8
+ export declare const emailAddressSchema: JSONSchema.String;
9
+ export declare const jsonObjectSchema: JSONSchema.Object<any>;
10
+ export declare const latitudeSchema: JSONSchema.Number;
11
+ export declare const localDateSchema: JSONSchema.String;
12
+ export declare const localDateTimeSchema: JSONSchema.String;
13
+ export declare const localTimeSchema: JSONSchema.String;
14
+ export declare const localeSchema: JSONSchema.String;
15
+ export declare const longitudeSchema: JSONSchema.Number;
16
+ export declare const timeZoneSchema: JSONSchema.String;
17
+ export declare const urlSchema: JSONSchema.String;
18
+ export declare const utcOffsetSchema: JSONSchema.String;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAMnD,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,MAI3C,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,UAAU,CAAC,MAIpC,CAAA;AAED,eAAO,MAAM,YAAY,oBAAwD,CAAA;AACjF,eAAO,MAAM,SAAS,mBAAiC,CAAA;AACvD,eAAO,MAAM,cAAc,mBAAsC,CAAA;AACjE,eAAO,MAAM,cAAc,mBAAsC,CAAA;AACjE,eAAO,MAAM,kBAAkB,mBAA0C,CAAA;AACzE,eAAO,MAAM,gBAAgB,wBAA2D,CAAA;AACxF,eAAO,MAAM,cAAc,mBAAyD,CAAA;AACpF,eAAO,MAAM,eAAe,mBAAuC,CAAA;AACnE,eAAO,MAAM,mBAAmB,mBAA2C,CAAA;AAC3E,eAAO,MAAM,eAAe,mBAAuC,CAAA;AACnE,eAAO,MAAM,YAAY,mBAAoC,CAAA;AAC7D,eAAO,MAAM,eAAe,mBAA0D,CAAA;AACtF,eAAO,MAAM,cAAc,mBAAsC,CAAA;AACjE,eAAO,MAAM,SAAS,mBAAiC,CAAA;AACvD,eAAO,MAAM,eAAe,mBAAuC,CAAA"}
package/lib/index.js ADDED
@@ -0,0 +1,32 @@
1
+ import { GraphQLBigInt, GraphQLDateTime, GraphQLDID, GraphQLDuration, GraphQLEmailAddress, GraphQLJSONObject, GraphQLLatitude, GraphQLLocalDate, GraphQLLocalDateTime, GraphQLLocale, GraphQLLocalTime, GraphQLLongitude, GraphQLTimeZone, GraphQLURL, GraphQLUtcOffset } from 'graphql-scalars';
2
+ function createScalarSchema(type) {
3
+ return {
4
+ ...type.extensions.jsonSchema,
5
+ title: type.name
6
+ };
7
+ }
8
+ export const attachmentIDSchema = {
9
+ type: 'string',
10
+ title: 'AttachmentID',
11
+ pattern: '^k[0-9a-z]{10,120}$'
12
+ };
13
+ export const docIDSchema = {
14
+ type: 'string',
15
+ title: 'DocID',
16
+ pattern: '^k[0-9a-z]{10,120}$'
17
+ };
18
+ export const bigIntSchema = createScalarSchema(GraphQLBigInt);
19
+ export const didSchema = createScalarSchema(GraphQLDID);
20
+ export const dateTimeSchema = createScalarSchema(GraphQLDateTime);
21
+ export const durationSchema = createScalarSchema(GraphQLDuration);
22
+ export const emailAddressSchema = createScalarSchema(GraphQLEmailAddress);
23
+ export const jsonObjectSchema = createScalarSchema(GraphQLJSONObject);
24
+ export const latitudeSchema = createScalarSchema(GraphQLLatitude);
25
+ export const localDateSchema = createScalarSchema(GraphQLLocalDate);
26
+ export const localDateTimeSchema = createScalarSchema(GraphQLLocalDateTime);
27
+ export const localTimeSchema = createScalarSchema(GraphQLLocalTime);
28
+ export const localeSchema = createScalarSchema(GraphQLLocale);
29
+ export const longitudeSchema = createScalarSchema(GraphQLLongitude);
30
+ export const timeZoneSchema = createScalarSchema(GraphQLTimeZone);
31
+ export const urlSchema = createScalarSchema(GraphQLURL);
32
+ export const utcOffsetSchema = createScalarSchema(GraphQLUtcOffset);
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@kubun/scalars",
3
+ "version": "0.4.0",
4
+ "license": "see LICENSE.md",
5
+ "keywords": [],
6
+ "type": "module",
7
+ "main": "lib/index.js",
8
+ "types": "lib/index.d.ts",
9
+ "exports": {
10
+ ".": "./lib/index.js"
11
+ },
12
+ "files": [
13
+ "lib/*",
14
+ "LICENSE.md"
15
+ ],
16
+ "sideEffects": false,
17
+ "dependencies": {
18
+ "graphql-scalars": "^1.25.0"
19
+ },
20
+ "devDependencies": {
21
+ "json-schema-typed": "^8.0.2"
22
+ },
23
+ "scripts": {
24
+ "build:clean": "del lib",
25
+ "build:js": "swc src -d ./lib --config-file ../../swc.json --strip-leading-paths",
26
+ "build:types": "tsc --emitDeclarationOnly --skipLibCheck",
27
+ "build:types:ci": "tsc --emitDeclarationOnly --declarationMap false",
28
+ "build": "pnpm run build:clean && pnpm run build:js && pnpm run build:types",
29
+ "test:types": "tsc --noEmit",
30
+ "test:unit": "vitest run",
31
+ "test": "pnpm run test:types && pnpm run test:unit"
32
+ }
33
+ }