@osaas/types 0.2.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/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +1 -0
- package/lib/schema/Tenant.d.ts +66 -0
- package/lib/schema/Tenant.d.ts.map +1 -0
- package/lib/schema/Tenant.js +70 -0
- package/lib/schema/Tenant.js.map +1 -0
- package/lib/schema/User.d.ts +88 -0
- package/lib/schema/User.d.ts.map +1 -0
- package/lib/schema/User.js +59 -0
- package/lib/schema/User.js.map +1 -0
- package/lib/schema/util.d.ts +2 -0
- package/lib/schema/util.d.ts.map +1 -0
- package/lib/schema/util.js +13 -0
- package/lib/schema/util.js.map +1 -0
- package/package.json +35 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./schema/Tenant"), exports);
|
|
18
|
+
__exportStar(require("./schema/User"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,gDAA8B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
import { Schema } from 'mongoose';
|
|
26
|
+
export declare const BILLING_OPTIONS: readonly ["paypal", "invoice"];
|
|
27
|
+
export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
|
|
28
|
+
_id: string;
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
billing: "paypal" | "invoice";
|
|
31
|
+
repositories: {
|
|
32
|
+
_id: string;
|
|
33
|
+
type: "github";
|
|
34
|
+
}[];
|
|
35
|
+
schemaVersion: number;
|
|
36
|
+
name?: string | undefined;
|
|
37
|
+
description?: string | undefined;
|
|
38
|
+
avatarUrl?: string | undefined;
|
|
39
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
40
|
+
_id: string;
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
billing: "paypal" | "invoice";
|
|
43
|
+
repositories: {
|
|
44
|
+
_id: string;
|
|
45
|
+
type: "github";
|
|
46
|
+
}[];
|
|
47
|
+
schemaVersion: number;
|
|
48
|
+
name?: string | undefined;
|
|
49
|
+
description?: string | undefined;
|
|
50
|
+
avatarUrl?: string | undefined;
|
|
51
|
+
}>> & import("mongoose").FlatRecord<{
|
|
52
|
+
_id: string;
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
billing: "paypal" | "invoice";
|
|
55
|
+
repositories: {
|
|
56
|
+
_id: string;
|
|
57
|
+
type: "github";
|
|
58
|
+
}[];
|
|
59
|
+
schemaVersion: number;
|
|
60
|
+
name?: string | undefined;
|
|
61
|
+
description?: string | undefined;
|
|
62
|
+
avatarUrl?: string | undefined;
|
|
63
|
+
}> & Required<{
|
|
64
|
+
_id: string;
|
|
65
|
+
}>>;
|
|
66
|
+
//# sourceMappingURL=Tenant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tenant.d.ts","sourceRoot":"","sources":["../../src/schema/Tenant.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAkB,MAAM,UAAU,CAAC;AAKlD,eAAO,MAAM,eAAe,gCAAiC,CAAC;AAM9D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DvB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TenantSchema = exports.BILLING_OPTIONS = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const util_1 = require("./util");
|
|
6
|
+
const SCHEMA_VERSION = 4;
|
|
7
|
+
exports.BILLING_OPTIONS = ['paypal', 'invoice'];
|
|
8
|
+
function tenantIdValidator(_id) {
|
|
9
|
+
return _id.length && _id.length <= 10 && /^[a-z]([a-z0-9])*$/.test(_id);
|
|
10
|
+
}
|
|
11
|
+
exports.TenantSchema = new mongoose_1.Schema({
|
|
12
|
+
_id: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true,
|
|
15
|
+
default: util_1.generateTenantId,
|
|
16
|
+
validate: {
|
|
17
|
+
validator: tenantIdValidator,
|
|
18
|
+
message: (props) => `${props.value} is not a valid id. Max 10 characters, start with a letter, and only contains lowercase letters and numbers.`
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
enabled: { type: Boolean, required: true, default: true },
|
|
22
|
+
name: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: false,
|
|
25
|
+
index: {
|
|
26
|
+
unique: true,
|
|
27
|
+
collation: {
|
|
28
|
+
// case insensitive
|
|
29
|
+
locale: 'simple',
|
|
30
|
+
strength: 1
|
|
31
|
+
},
|
|
32
|
+
// only index documents that have a name field
|
|
33
|
+
partialFilterExpression: { name: { $type: 'string' } }
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
description: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: false
|
|
39
|
+
},
|
|
40
|
+
avatarUrl: {
|
|
41
|
+
type: String,
|
|
42
|
+
required: false
|
|
43
|
+
},
|
|
44
|
+
billing: {
|
|
45
|
+
type: String,
|
|
46
|
+
enum: ['paypal', 'invoice'],
|
|
47
|
+
required: true,
|
|
48
|
+
default: 'invoice'
|
|
49
|
+
},
|
|
50
|
+
repositories: [
|
|
51
|
+
{
|
|
52
|
+
type: {
|
|
53
|
+
type: String,
|
|
54
|
+
enum: ['github'],
|
|
55
|
+
required: true,
|
|
56
|
+
default: 'github'
|
|
57
|
+
},
|
|
58
|
+
_id: {
|
|
59
|
+
type: String,
|
|
60
|
+
required: true
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
schemaVersion: {
|
|
65
|
+
type: Number,
|
|
66
|
+
required: true,
|
|
67
|
+
default: SCHEMA_VERSION
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=Tenant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tenant.js","sourceRoot":"","sources":["../../src/schema/Tenant.ts"],"names":[],"mappings":";;;AAAA,uCAAkD;AAClD,iCAA0C;AAE1C,MAAM,cAAc,GAAG,CAAC,CAAC;AAEZ,QAAA,eAAe,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAU,CAAC;AAE9D,SAAS,iBAAiB,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,EAAE,IAAI,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1E,CAAC;AAEY,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACrC,GAAG,EAAE;QACH,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,uBAAgB;QACzB,QAAQ,EAAE;YACR,SAAS,EAAE,iBAAiB;YAC5B,OAAO,EAAE,CAAC,KAAqB,EAAE,EAAE,CACjC,GAAG,KAAK,CAAC,KAAK,8GAA8G;SAC/H;KACF;IACD,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;IACzD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;QACf,KAAK,EAAE;YACL,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE;gBACT,mBAAmB;gBACnB,MAAM,EAAE,QAAQ;gBAChB,QAAQ,EAAE,CAAC;aACZ;YACD,8CAA8C;YAC9C,uBAAuB,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;SACvD;KACF;IACD,WAAW,EAAE;QACX,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KAChB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KAChB;IACD,OAAO,EAAE;QACP,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;QAC3B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,SAAS;KACnB;IACD,YAAY,EAAE;QACZ;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,CAAC,QAAQ,CAAC;gBAChB,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,QAAQ;aAClB;YACD,GAAG,EAAE;gBACH,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,aAAa,EAAE;QACb,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,cAAc;KACxB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
import { Schema } from 'mongoose';
|
|
26
|
+
export type UserRole = 'osaas-admin' | 'user';
|
|
27
|
+
export type TenantUserRole = 'owner' | 'admin' | 'member';
|
|
28
|
+
export declare const UserSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
|
|
29
|
+
paypal: {
|
|
30
|
+
payerId?: string | undefined;
|
|
31
|
+
};
|
|
32
|
+
schemaVersion: number;
|
|
33
|
+
role: UserRole;
|
|
34
|
+
email: string;
|
|
35
|
+
tenants: {
|
|
36
|
+
_id: string;
|
|
37
|
+
role: "owner" | "admin" | "member";
|
|
38
|
+
personalAccessToken: string;
|
|
39
|
+
}[];
|
|
40
|
+
notifications: import("mongoose").Types.DocumentArray<{
|
|
41
|
+
message: string;
|
|
42
|
+
link: string;
|
|
43
|
+
}>;
|
|
44
|
+
favoriteServices: string[];
|
|
45
|
+
lastAccessed?: Date | undefined;
|
|
46
|
+
emailVerified?: Date | undefined;
|
|
47
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
48
|
+
paypal: {
|
|
49
|
+
payerId?: string | undefined;
|
|
50
|
+
};
|
|
51
|
+
schemaVersion: number;
|
|
52
|
+
role: UserRole;
|
|
53
|
+
email: string;
|
|
54
|
+
tenants: {
|
|
55
|
+
_id: string;
|
|
56
|
+
role: "owner" | "admin" | "member";
|
|
57
|
+
personalAccessToken: string;
|
|
58
|
+
}[];
|
|
59
|
+
notifications: import("mongoose").Types.DocumentArray<{
|
|
60
|
+
message: string;
|
|
61
|
+
link: string;
|
|
62
|
+
}>;
|
|
63
|
+
favoriteServices: string[];
|
|
64
|
+
lastAccessed?: Date | undefined;
|
|
65
|
+
emailVerified?: Date | undefined;
|
|
66
|
+
}>> & import("mongoose").FlatRecord<{
|
|
67
|
+
paypal: {
|
|
68
|
+
payerId?: string | undefined;
|
|
69
|
+
};
|
|
70
|
+
schemaVersion: number;
|
|
71
|
+
role: UserRole;
|
|
72
|
+
email: string;
|
|
73
|
+
tenants: {
|
|
74
|
+
_id: string;
|
|
75
|
+
role: "owner" | "admin" | "member";
|
|
76
|
+
personalAccessToken: string;
|
|
77
|
+
}[];
|
|
78
|
+
notifications: import("mongoose").Types.DocumentArray<{
|
|
79
|
+
message: string;
|
|
80
|
+
link: string;
|
|
81
|
+
}>;
|
|
82
|
+
favoriteServices: string[];
|
|
83
|
+
lastAccessed?: Date | undefined;
|
|
84
|
+
emailVerified?: Date | undefined;
|
|
85
|
+
}> & {
|
|
86
|
+
_id: import("mongoose").Types.ObjectId;
|
|
87
|
+
}>;
|
|
88
|
+
//# sourceMappingURL=User.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../src/schema/User.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAC;AAC9C,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AAW1D,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CrB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const SCHEMA_VERSION = 5;
|
|
6
|
+
const UserRoles = ['osaas-admin', 'user'];
|
|
7
|
+
const NotificationSchema = new mongoose_1.Schema({
|
|
8
|
+
message: { type: String, required: true },
|
|
9
|
+
link: { type: String, required: true }
|
|
10
|
+
});
|
|
11
|
+
exports.UserSchema = new mongoose_1.Schema({
|
|
12
|
+
lastAccessed: {
|
|
13
|
+
type: Date
|
|
14
|
+
},
|
|
15
|
+
emailVerified: {
|
|
16
|
+
type: Date
|
|
17
|
+
},
|
|
18
|
+
role: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
enum: UserRoles,
|
|
22
|
+
default: 'user'
|
|
23
|
+
},
|
|
24
|
+
email: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: true,
|
|
27
|
+
index: {
|
|
28
|
+
unique: true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
paypal: {
|
|
32
|
+
type: {
|
|
33
|
+
payerId: { type: String }
|
|
34
|
+
},
|
|
35
|
+
required: true,
|
|
36
|
+
default: {},
|
|
37
|
+
_id: false
|
|
38
|
+
},
|
|
39
|
+
tenants: [
|
|
40
|
+
{
|
|
41
|
+
_id: { type: String, ref: 'Tenant', required: true },
|
|
42
|
+
role: {
|
|
43
|
+
type: String,
|
|
44
|
+
enum: ['owner', 'admin', 'member'],
|
|
45
|
+
required: true,
|
|
46
|
+
default: 'member'
|
|
47
|
+
},
|
|
48
|
+
personalAccessToken: { type: String, required: true }
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
notifications: [NotificationSchema],
|
|
52
|
+
favoriteServices: [{ type: String, required: true, default: [] }],
|
|
53
|
+
schemaVersion: {
|
|
54
|
+
type: Number,
|
|
55
|
+
required: true,
|
|
56
|
+
default: SCHEMA_VERSION
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=User.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/schema/User.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAKlC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB,MAAM,SAAS,GAAe,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAEtD,MAAM,kBAAkB,GAAG,IAAI,iBAAM,CAAC;IACpC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;CACvC,CAAC,CAAC;AAEU,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACnC,YAAY,EAAE;QACZ,IAAI,EAAE,IAAI;KACX;IACD,aAAa,EAAE;QACb,IAAI,EAAE,IAAI;KACX;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,MAAM;KAChB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE;YACL,MAAM,EAAE,IAAI;SACb;KACF;IACD,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SAC1B;QACD,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,GAAG,EAAE,KAAK;KACX;IACD,OAAO,EAAE;QACP;YACE,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;YACpD,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC;gBAClC,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,QAAQ;aAClB;YACD,mBAAmB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;SACtD;KACF;IACD,aAAa,EAAE,CAAC,kBAAkB,CAAC;IACnC,gBAAgB,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACjE,aAAa,EAAE;QACb,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,cAAc;KACxB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/schema/util.ts"],"names":[],"mappings":"AAMA,wBAAgB,gBAAgB,WAG/B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateTenantId = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const nanoid_1 = require("nanoid");
|
|
6
|
+
const letterOnlyNanoid = (0, nanoid_1.customAlphabet)('abcdefghijklmnopqrstuvwxyz', 1);
|
|
7
|
+
const nanoid = (0, nanoid_1.customAlphabet)('0123456789abcdefghijklmnopqrstuvwxyz', 9);
|
|
8
|
+
function generateTenantId() {
|
|
9
|
+
const length = (0, crypto_1.randomInt)(8, 10);
|
|
10
|
+
return `${letterOnlyNanoid()}${nanoid(length)}`;
|
|
11
|
+
}
|
|
12
|
+
exports.generateTenantId = generateTenantId;
|
|
13
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/schema/util.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,mCAAwC;AAExC,MAAM,gBAAgB,GAAG,IAAA,uBAAc,EAAC,4BAA4B,EAAE,CAAC,CAAC,CAAC;AACzE,MAAM,MAAM,GAAG,IAAA,uBAAc,EAAC,sCAAsC,EAAE,CAAC,CAAC,CAAC;AAEzE,SAAgB,gBAAgB;IAC9B,MAAM,MAAM,GAAG,IAAA,kBAAS,EAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChC,OAAO,GAAG,gBAAgB,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;AAClD,CAAC;AAHD,4CAGC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@osaas/types",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "OSaaS shared types",
|
|
5
|
+
"author": "Jonas Birmé <jonas.birme@eyevinn.se>",
|
|
6
|
+
"homepage": "https://github.com/Eyevinn/osaas-lib-util#readme",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"main": "lib/index.js",
|
|
9
|
+
"types": "lib/index.d.ts",
|
|
10
|
+
"directories": {
|
|
11
|
+
"lib": "lib"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"lib"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/Eyevinn/osaas-lib-util.git"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.json",
|
|
22
|
+
"lint": "eslint .",
|
|
23
|
+
"pretty": "prettier --check --ignore-unknown .",
|
|
24
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
25
|
+
"test": "jest --passWithNoTests"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/Eyevinn/osaas-lib-util/issues"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"mongoose": "^7.4.3",
|
|
32
|
+
"nanoid": "^5.0.2"
|
|
33
|
+
},
|
|
34
|
+
"gitHead": "86fc981fb6ae9f0dffffadbb9a4babb5065d3098"
|
|
35
|
+
}
|