insite-common 2.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/LICENSE +21 -0
- package/README.md +13 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/types.d.ts +41 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Eugene Nesvetaev
|
|
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
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types";
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
type CommonSchema = {
|
|
2
|
+
_id: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
};
|
|
5
|
+
export type AbilityParamItemSchema = CommonSchema;
|
|
6
|
+
type AbilityParamItemsSchema = {
|
|
7
|
+
type: "items";
|
|
8
|
+
items: readonly AbilityParamItemSchema[];
|
|
9
|
+
isInheritable?: boolean;
|
|
10
|
+
} & CommonSchema;
|
|
11
|
+
type AbilityParamNumberSchema = {
|
|
12
|
+
type: "number";
|
|
13
|
+
min?: number;
|
|
14
|
+
max?: number;
|
|
15
|
+
isInheritable?: boolean;
|
|
16
|
+
} & CommonSchema;
|
|
17
|
+
type AbilityParamSchema = AbilityParamItemsSchema | AbilityParamNumberSchema;
|
|
18
|
+
export type AbilitySchema = {
|
|
19
|
+
params?: readonly AbilityParamSchema[];
|
|
20
|
+
subAbilities?: AbilitiesSchema;
|
|
21
|
+
isInheritable?: boolean;
|
|
22
|
+
} & CommonSchema;
|
|
23
|
+
export type AbilitiesSchema = readonly AbilitySchema[];
|
|
24
|
+
type ExtractParamSchemaType<PS extends AbilityParamSchema> = PS extends AbilityParamNumberSchema ? number : PS extends AbilityParamItemsSchema ? PS["items"][number]["_id"][] : never;
|
|
25
|
+
type ExtractAbilitySchemaType<AS extends AbilitySchema> = AS["params"] extends readonly AbilityParamSchema[] ? {
|
|
26
|
+
[K in AS["params"][number] as K["_id"]]: ExtractParamSchemaType<K>;
|
|
27
|
+
} : true;
|
|
28
|
+
type FlattenAbilitySchema<A extends AbilitySchema> = {
|
|
29
|
+
[K in A["_id"]]: ExtractAbilitySchemaType<A>;
|
|
30
|
+
} & (A["subAbilities"] extends AbilitiesSchema ? FlattenAbilitySchemas<A["subAbilities"]> : object);
|
|
31
|
+
export type FlattenAbilitySchemas<A extends AbilitiesSchema> = Partial<A extends readonly [infer Head extends AbilitySchema, ...infer Tail extends AbilitiesSchema] ? FlattenAbilitySchema<Head> & FlattenAbilitySchemas<Tail> : object>;
|
|
32
|
+
export type Abilities<A extends AbilitiesSchema> = {
|
|
33
|
+
login?: {
|
|
34
|
+
sessionsLimit: number;
|
|
35
|
+
};
|
|
36
|
+
inSite?: {
|
|
37
|
+
sections: ("users")[];
|
|
38
|
+
};
|
|
39
|
+
} & FlattenAbilitySchemas<A>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAC;AAElD,KAAK,uBAAuB,GAAG;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACzC,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,YAAY,CAAC;AAEjB,KAAK,wBAAwB,GAAG;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,YAAY,CAAC;AAEjB,KAAK,kBAAkB,GAAG,uBAAuB,GAAG,wBAAwB,CAAC;AAE7E,MAAM,MAAM,aAAa,GAAG;IAC3B,MAAM,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACvC,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,aAAa,CAAC,EAAE,OA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CAAC;KACtB,CAAC;CACF,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "insite-common",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "inSite common things",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js",
|
|
10
|
+
"./types": "./dist/types.js"
|
|
11
|
+
},
|
|
12
|
+
"packageManager": "bun@1.1.26",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
15
|
+
"build": "tsc -p ."
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/nesvet/insite-common.git"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"insite",
|
|
23
|
+
"common"
|
|
24
|
+
],
|
|
25
|
+
"author": "Eugene Nesvetaev <dev@nesvet.dev> (https://nesvet.dev/)",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@nesvet/conveyer": "^2.2.4",
|
|
32
|
+
"@nesvet/eslint-config": "^2.0.25",
|
|
33
|
+
"typescript": "^5.5.4"
|
|
34
|
+
}
|
|
35
|
+
}
|