@bsb/registry 1.0.1
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/README.md +133 -0
- package/bsb-plugin.json +47 -0
- package/lib/.bsb/clients/service-bsb-registry.d.ts +1118 -0
- package/lib/.bsb/clients/service-bsb-registry.d.ts.map +1 -0
- package/lib/.bsb/clients/service-bsb-registry.js +393 -0
- package/lib/.bsb/clients/service-bsb-registry.js.map +1 -0
- package/lib/plugins/service-bsb-registry/auth.d.ts +87 -0
- package/lib/plugins/service-bsb-registry/auth.d.ts.map +1 -0
- package/lib/plugins/service-bsb-registry/auth.js +197 -0
- package/lib/plugins/service-bsb-registry/auth.js.map +1 -0
- package/lib/plugins/service-bsb-registry/db/file.d.ts +73 -0
- package/lib/plugins/service-bsb-registry/db/file.d.ts.map +1 -0
- package/lib/plugins/service-bsb-registry/db/file.js +588 -0
- package/lib/plugins/service-bsb-registry/db/file.js.map +1 -0
- package/lib/plugins/service-bsb-registry/db/index.d.ts +75 -0
- package/lib/plugins/service-bsb-registry/db/index.d.ts.map +1 -0
- package/lib/plugins/service-bsb-registry/db/index.js +24 -0
- package/lib/plugins/service-bsb-registry/db/index.js.map +1 -0
- package/lib/plugins/service-bsb-registry/index.d.ts +1228 -0
- package/lib/plugins/service-bsb-registry/index.d.ts.map +1 -0
- package/lib/plugins/service-bsb-registry/index.js +661 -0
- package/lib/plugins/service-bsb-registry/index.js.map +1 -0
- package/lib/plugins/service-bsb-registry/types.d.ts +559 -0
- package/lib/plugins/service-bsb-registry/types.d.ts.map +1 -0
- package/lib/plugins/service-bsb-registry/types.js +235 -0
- package/lib/plugins/service-bsb-registry/types.js.map +1 -0
- package/lib/plugins/service-bsb-registry-ui/http-server.d.ts +138 -0
- package/lib/plugins/service-bsb-registry-ui/http-server.d.ts.map +1 -0
- package/lib/plugins/service-bsb-registry-ui/http-server.js +1660 -0
- package/lib/plugins/service-bsb-registry-ui/http-server.js.map +1 -0
- package/lib/plugins/service-bsb-registry-ui/index.d.ts +62 -0
- package/lib/plugins/service-bsb-registry-ui/index.d.ts.map +1 -0
- package/lib/plugins/service-bsb-registry-ui/index.js +101 -0
- package/lib/plugins/service-bsb-registry-ui/index.js.map +1 -0
- package/lib/plugins/service-bsb-registry-ui/static/assets/images/apple-touch-icon.png +0 -0
- package/lib/plugins/service-bsb-registry-ui/static/assets/images/favicon-16x16.png +0 -0
- package/lib/plugins/service-bsb-registry-ui/static/assets/images/favicon-32x32.png +0 -0
- package/lib/plugins/service-bsb-registry-ui/static/assets/images/favicon.ico +0 -0
- package/lib/plugins/service-bsb-registry-ui/static/css/style.css +1849 -0
- package/lib/plugins/service-bsb-registry-ui/static/js/app.js +336 -0
- package/lib/plugins/service-bsb-registry-ui/templates/layouts/main.hbs +39 -0
- package/lib/plugins/service-bsb-registry-ui/templates/pages/error.hbs +13 -0
- package/lib/plugins/service-bsb-registry-ui/templates/pages/home.hbs +62 -0
- package/lib/plugins/service-bsb-registry-ui/templates/pages/not-found.hbs +13 -0
- package/lib/plugins/service-bsb-registry-ui/templates/pages/plugin-detail.hbs +537 -0
- package/lib/plugins/service-bsb-registry-ui/templates/pages/plugins.hbs +40 -0
- package/lib/plugins/service-bsb-registry-ui/templates/partials/pagination.hbs +41 -0
- package/lib/plugins/service-bsb-registry-ui/templates/partials/plugin-card.hbs +40 -0
- package/lib/plugins/service-bsb-registry-ui/templates/partials/search-form.hbs +31 -0
- package/lib/schemas/service-bsb-registry-ui.json +57 -0
- package/lib/schemas/service-bsb-registry-ui.plugin.json +73 -0
- package/lib/schemas/service-bsb-registry.json +1883 -0
- package/lib/schemas/service-bsb-registry.plugin.json +68 -0
- package/package.json +60 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database interface and factory for BSB Registry storage.
|
|
3
|
+
*
|
|
4
|
+
* All storage backends (file, postgres, etc.) must implement RegistryDB.
|
|
5
|
+
* Use createStorage() to get the right implementation for a given config.
|
|
6
|
+
*/
|
|
7
|
+
import type { Observable } from '@bsb/base';
|
|
8
|
+
import type { RegistryEntry, ListQuery, SearchQuery, RegistryStats, VersionInfo, Organization, OrgMember, ResourcePermission, User, AuthToken } from '../types';
|
|
9
|
+
export interface RegistryDB {
|
|
10
|
+
/** Initialize the database (create dirs, run migrations, etc.) */
|
|
11
|
+
init(obs: Observable): Promise<void>;
|
|
12
|
+
/** Clean up resources (close handles, flush writes, etc.) */
|
|
13
|
+
dispose(): Promise<void>;
|
|
14
|
+
/** Check whether a specific version of a plugin exists */
|
|
15
|
+
versionExists(obs: Observable, org: string, name: string, version: string): Promise<boolean>;
|
|
16
|
+
/** Insert a new plugin version. Must reject if version already exists. */
|
|
17
|
+
insert(obs: Observable, entry: RegistryEntry): Promise<void>;
|
|
18
|
+
/** Get a single plugin. Returns latest version when version is omitted. */
|
|
19
|
+
get(obs: Observable, org: string, name: string, version?: string): Promise<RegistryEntry | null>;
|
|
20
|
+
/** Delete a plugin -- a single version when specified, otherwise all versions. */
|
|
21
|
+
delete(obs: Observable, org: string, name: string, version?: string): Promise<void>;
|
|
22
|
+
/** List plugins with optional filters and pagination. Returns latest version of each plugin. */
|
|
23
|
+
list(obs: Observable, query: ListQuery): Promise<{
|
|
24
|
+
results: RegistryEntry[];
|
|
25
|
+
total: number;
|
|
26
|
+
}>;
|
|
27
|
+
/** Full-text search across plugin metadata. Returns latest version of each match. */
|
|
28
|
+
search(obs: Observable, query: SearchQuery): Promise<{
|
|
29
|
+
results: RegistryEntry[];
|
|
30
|
+
total: number;
|
|
31
|
+
}>;
|
|
32
|
+
/** Get all versions of a plugin, optionally filtered to a major.minor. Sorted newest-first. */
|
|
33
|
+
getVersions(obs: Observable, org: string, name: string, majorMinor?: string): Promise<VersionInfo[]>;
|
|
34
|
+
/** Aggregate registry statistics. */
|
|
35
|
+
getStats(obs: Observable): Promise<RegistryStats>;
|
|
36
|
+
/** Get organization details (with live plugin count and members). */
|
|
37
|
+
getOrganization(obs: Observable, orgId: string): Promise<Organization | null>;
|
|
38
|
+
/** Create an organization if it does not already exist. Returns the org. */
|
|
39
|
+
createOrganization(obs: Observable, orgId: string, displayName: string, visibility: 'public' | 'private'): Promise<Organization>;
|
|
40
|
+
/** Add or update a member in an organization. */
|
|
41
|
+
setOrgMember(obs: Observable, orgId: string, userId: string, permission: ResourcePermission): Promise<void>;
|
|
42
|
+
/** Remove a member from an organization. */
|
|
43
|
+
removeOrgMember(obs: Observable, orgId: string, userId: string): Promise<void>;
|
|
44
|
+
/** Get the members list for an organization. Returns empty array if org not found. */
|
|
45
|
+
getOrgMembers(obs: Observable, orgId: string): Promise<OrgMember[]>;
|
|
46
|
+
/** Get a user by ID. Returns null if not found. */
|
|
47
|
+
getUser(obs: Observable, userId: string): Promise<User | null>;
|
|
48
|
+
/** Get a user by email address. Returns null if not found. */
|
|
49
|
+
getUserByEmail(obs: Observable, email: string): Promise<User | null>;
|
|
50
|
+
/** List all users. */
|
|
51
|
+
listUsers(obs: Observable): Promise<User[]>;
|
|
52
|
+
/** Insert a new user. Must reject if a user with the same ID already exists. */
|
|
53
|
+
createUser(obs: Observable, user: User): Promise<void>;
|
|
54
|
+
/** Update an existing user. Merges the provided fields. Returns the updated user or null if not found. */
|
|
55
|
+
updateUser(obs: Observable, userId: string, updates: Partial<Pick<User, 'name' | 'email' | 'active' | 'permissions'>>): Promise<User | null>;
|
|
56
|
+
/** Get a token by its token string. Returns null if not found. */
|
|
57
|
+
getToken(obs: Observable, tokenString: string): Promise<AuthToken | null>;
|
|
58
|
+
/** Get all tokens belonging to a user. */
|
|
59
|
+
getTokensForUser(obs: Observable, userId: string): Promise<AuthToken[]>;
|
|
60
|
+
/** Insert a new token. */
|
|
61
|
+
createToken(obs: Observable, token: AuthToken): Promise<void>;
|
|
62
|
+
/** Delete a specific token by its token string. Returns true if deleted. */
|
|
63
|
+
deleteToken(obs: Observable, tokenString: string): Promise<boolean>;
|
|
64
|
+
/** Delete all tokens belonging to a user. Returns the number deleted. */
|
|
65
|
+
deleteTokensForUser(obs: Observable, userId: string): Promise<number>;
|
|
66
|
+
}
|
|
67
|
+
export interface StorageConfig {
|
|
68
|
+
type: 'file' | 'postgres';
|
|
69
|
+
path: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create the appropriate RegistryDB implementation for the given config.
|
|
73
|
+
*/
|
|
74
|
+
export declare function createStorage(config: StorageConfig): RegistryDB;
|
|
75
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/service-bsb-registry/db/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,IAAI,EACJ,SAAS,EACV,MAAM,UAAU,CAAC;AAGlB,MAAM,WAAW,UAAU;IACzB,kEAAkE;IAClE,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErC,6DAA6D;IAC7D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAIzB,0DAA0D;IAC1D,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7F,0EAA0E;IAC1E,MAAM,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D,2EAA2E;IAC3E,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CA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AAC;IAExE,0BAA0B;IAC1B,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9D,4EAA4E;IAC5E,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpE,yEAAyE;IACzE,mBAAmB,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACvE;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,UAAU,CAW/D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Database interface and factory for BSB Registry storage.
|
|
4
|
+
*
|
|
5
|
+
* All storage backends (file, postgres, etc.) must implement RegistryDB.
|
|
6
|
+
* Use createStorage() to get the right implementation for a given config.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.createStorage = createStorage;
|
|
10
|
+
const file_1 = require("./file");
|
|
11
|
+
/**
|
|
12
|
+
* Create the appropriate RegistryDB implementation for the given config.
|
|
13
|
+
*/
|
|
14
|
+
function createStorage(config) {
|
|
15
|
+
switch (config.type) {
|
|
16
|
+
case 'file':
|
|
17
|
+
return new file_1.FileDB(config.path);
|
|
18
|
+
case 'postgres':
|
|
19
|
+
throw new Error('PostgreSQL storage is not yet implemented');
|
|
20
|
+
default:
|
|
21
|
+
throw new Error(`Unknown database type: ${config.type}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/service-bsb-registry/db/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAgHH,sCAWC;AA5GD,iCAAgC;AA8FhC;;GAEG;AACH,SAAgB,aAAa,CAAC,MAAqB;IACjD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,MAAM;YACT,OAAO,IAAI,aAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEjC,KAAK,UAAU;YACb,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAE/D;YACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC"}
|