@byterings-dev/contracts 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/dist/api-keys.d.ts +54 -0
- package/dist/api-keys.js +23 -0
- package/dist/api-keys.js.map +1 -0
- package/dist/audit.d.ts +21 -0
- package/dist/audit.js +22 -0
- package/dist/audit.js.map +1 -0
- package/dist/auth.d.ts +76 -0
- package/dist/auth.js +39 -0
- package/dist/auth.js.map +1 -0
- package/dist/common.d.ts +27 -0
- package/dist/common.js +25 -0
- package/dist/common.js.map +1 -0
- package/dist/config.d.ts +241 -0
- package/dist/config.js +73 -0
- package/dist/config.js.map +1 -0
- package/dist/entities.d.ts +140 -0
- package/dist/entities.js +62 -0
- package/dist/entities.js.map +1 -0
- package/dist/fields.d.ts +233 -0
- package/dist/fields.js +445 -0
- package/dist/fields.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/media.d.ts +48 -0
- package/dist/media.js +46 -0
- package/dist/media.js.map +1 -0
- package/dist/members.d.ts +40 -0
- package/dist/members.js +26 -0
- package/dist/members.js.map +1 -0
- package/dist/openapi.d.ts +122 -0
- package/dist/openapi.js +958 -0
- package/dist/openapi.js.map +1 -0
- package/dist/pagination.d.ts +25 -0
- package/dist/pagination.js +30 -0
- package/dist/pagination.js.map +1 -0
- package/dist/permissions.d.ts +46 -0
- package/dist/permissions.js +73 -0
- package/dist/permissions.js.map +1 -0
- package/dist/plugins.d.ts +204 -0
- package/dist/plugins.js +108 -0
- package/dist/plugins.js.map +1 -0
- package/dist/records.d.ts +50 -0
- package/dist/records.js +47 -0
- package/dist/records.js.map +1 -0
- package/dist/release.d.ts +75 -0
- package/dist/release.js +32 -0
- package/dist/release.js.map +1 -0
- package/dist/templates.d.ts +142 -0
- package/dist/templates.js +79 -0
- package/dist/templates.js.map +1 -0
- package/dist/tenants.d.ts +52 -0
- package/dist/tenants.js +47 -0
- package/dist/tenants.js.map +1 -0
- package/package.json +29 -3
- package/README.md +0 -3
package/dist/members.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateMemberRequestSchema = exports.addMemberRequestSchema = exports.memberSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const permissions_1 = require("./permissions");
|
|
6
|
+
const tenants_1 = require("./tenants");
|
|
7
|
+
exports.memberSchema = zod_1.z.object({
|
|
8
|
+
id: zod_1.z.uuid(),
|
|
9
|
+
userId: zod_1.z.uuid(),
|
|
10
|
+
email: zod_1.z.string(),
|
|
11
|
+
name: zod_1.z.string(),
|
|
12
|
+
role: permissions_1.roleSchema,
|
|
13
|
+
createdAt: zod_1.z.string(),
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Adds an existing user by email, or creates the user when `password` and
|
|
17
|
+
* `name` are supplied and the email is not yet registered.
|
|
18
|
+
*/
|
|
19
|
+
exports.addMemberRequestSchema = zod_1.z.object({
|
|
20
|
+
email: tenants_1.emailSchema,
|
|
21
|
+
role: permissions_1.roleSchema,
|
|
22
|
+
name: zod_1.z.string().trim().min(1).max(120).optional(),
|
|
23
|
+
password: tenants_1.passwordSchema.optional(),
|
|
24
|
+
});
|
|
25
|
+
exports.updateMemberRequestSchema = zod_1.z.object({ role: permissions_1.roleSchema });
|
|
26
|
+
//# sourceMappingURL=members.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"members.js","sourceRoot":"","sources":["../src/members.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,+CAA2C;AAC3C,uCAAwD;AAE3C,QAAA,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,EAAE,EAAE,OAAC,CAAC,IAAI,EAAE;IACZ,MAAM,EAAE,OAAC,CAAC,IAAI,EAAE;IAChB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,wBAAU;IAChB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAGH;;;GAGG;AACU,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,qBAAW;IAClB,IAAI,EAAE,wBAAU;IAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAClD,QAAQ,EAAE,wBAAc,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAGU,QAAA,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,wBAAU,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAPI 3.1 documents generated from the shared Zod contracts (ADR-007).
|
|
3
|
+
*
|
|
4
|
+
* - `API_OPERATIONS` is the single registry of every REST operation. A
|
|
5
|
+
* contract test in the API fails when a route is missing here.
|
|
6
|
+
* - `buildOpenApiDocument()` renders the platform-wide specification.
|
|
7
|
+
* - `buildTenantOpenApiDocument()` adds typed schemas and paths for one
|
|
8
|
+
* tenant's entities, derived from their field definitions.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { type EntityDefinition } from './entities';
|
|
12
|
+
import { type FieldDefinition } from './fields';
|
|
13
|
+
import { type Permission } from './permissions';
|
|
14
|
+
type JsonSchema = Record<string, unknown>;
|
|
15
|
+
type HttpMethod = 'get' | 'post' | 'patch' | 'put' | 'delete';
|
|
16
|
+
export interface QueryParam {
|
|
17
|
+
name: string;
|
|
18
|
+
schema: JsonSchema;
|
|
19
|
+
description?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface OperationSpec {
|
|
22
|
+
method: HttpMethod;
|
|
23
|
+
/** OpenAPI path relative to /api/v1, e.g. /entities/{entityKey}/records */
|
|
24
|
+
path: string;
|
|
25
|
+
tag: string;
|
|
26
|
+
summary: string;
|
|
27
|
+
/** public: no auth; user: browser session only; any: session or API key */
|
|
28
|
+
auth: 'public' | 'user' | 'any' | 'platformAdmin';
|
|
29
|
+
permission?: Permission;
|
|
30
|
+
query?: QueryParam[];
|
|
31
|
+
body?: z.ZodType;
|
|
32
|
+
/** Response payload schema (already including any envelope). */
|
|
33
|
+
response?: z.ZodType;
|
|
34
|
+
status?: number;
|
|
35
|
+
/** Non-JSON response description (e.g. HTML, files). */
|
|
36
|
+
contentType?: string;
|
|
37
|
+
}
|
|
38
|
+
/** Every REST operation of API v1. Keep in sync with the controllers. */
|
|
39
|
+
export declare const API_OPERATIONS: OperationSpec[];
|
|
40
|
+
export declare function buildOpenApiDocument(opts?: {
|
|
41
|
+
serverUrl?: string;
|
|
42
|
+
version?: string;
|
|
43
|
+
}): {
|
|
44
|
+
openapi: string;
|
|
45
|
+
info: {
|
|
46
|
+
title: string;
|
|
47
|
+
version: string;
|
|
48
|
+
license: {
|
|
49
|
+
name: string;
|
|
50
|
+
identifier: string;
|
|
51
|
+
};
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
54
|
+
servers: {
|
|
55
|
+
url: string;
|
|
56
|
+
}[];
|
|
57
|
+
components: {
|
|
58
|
+
securitySchemes: {
|
|
59
|
+
sessionCookie: {
|
|
60
|
+
type: string;
|
|
61
|
+
in: string;
|
|
62
|
+
name: string;
|
|
63
|
+
};
|
|
64
|
+
csrfToken: {
|
|
65
|
+
type: string;
|
|
66
|
+
in: string;
|
|
67
|
+
name: string;
|
|
68
|
+
};
|
|
69
|
+
apiKey: {
|
|
70
|
+
type: string;
|
|
71
|
+
scheme: string;
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
schemas: Record<string, JsonSchema>;
|
|
76
|
+
};
|
|
77
|
+
paths: Record<string, Record<string, unknown>>;
|
|
78
|
+
};
|
|
79
|
+
/** JSON Schema of one field's value (nullable unless required). */
|
|
80
|
+
export declare function fieldValueJsonSchema(field: Pick<FieldDefinition, 'type' | 'config' | 'required' | 'label' | 'description'>): JsonSchema;
|
|
81
|
+
/** OpenAPI document with typed record schemas and paths for each entity. */
|
|
82
|
+
export declare function buildTenantOpenApiDocument(entities: EntityDefinition[], opts?: {
|
|
83
|
+
serverUrl?: string;
|
|
84
|
+
version?: string;
|
|
85
|
+
tenantName?: string;
|
|
86
|
+
}): {
|
|
87
|
+
openapi: string;
|
|
88
|
+
info: {
|
|
89
|
+
title: string;
|
|
90
|
+
version: string;
|
|
91
|
+
license: {
|
|
92
|
+
name: string;
|
|
93
|
+
identifier: string;
|
|
94
|
+
};
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
servers: {
|
|
98
|
+
url: string;
|
|
99
|
+
}[];
|
|
100
|
+
components: {
|
|
101
|
+
securitySchemes: {
|
|
102
|
+
sessionCookie: {
|
|
103
|
+
type: string;
|
|
104
|
+
in: string;
|
|
105
|
+
name: string;
|
|
106
|
+
};
|
|
107
|
+
csrfToken: {
|
|
108
|
+
type: string;
|
|
109
|
+
in: string;
|
|
110
|
+
name: string;
|
|
111
|
+
};
|
|
112
|
+
apiKey: {
|
|
113
|
+
type: string;
|
|
114
|
+
scheme: string;
|
|
115
|
+
description: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
schemas: Record<string, JsonSchema>;
|
|
119
|
+
};
|
|
120
|
+
paths: Record<string, Record<string, unknown>>;
|
|
121
|
+
};
|
|
122
|
+
export {};
|