@pgfsm/api 0.0.0-stage → 0.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/esm/_dnt.polyfills.d.ts +17 -0
- package/esm/_dnt.polyfills.js +15 -0
- package/esm/_dnt.shims.d.ts +5 -0
- package/esm/_dnt.shims.js +61 -0
- package/esm/database-src/generated/database.types.d.ts +2131 -0
- package/esm/database-src/generated/database.types.js +21 -0
- package/esm/deps/jsr.io/@std/cli/1.0.31/parse_args.d.ts +342 -0
- package/esm/deps/jsr.io/@std/cli/1.0.31/parse_args.js +372 -0
- package/esm/fsm-api-ts/env.d.ts +143 -0
- package/esm/fsm-api-ts/env.js +72 -0
- package/esm/fsm-api-ts/lib/configure-open-api.d.ts +3 -0
- package/esm/fsm-api-ts/lib/configure-open-api.js +25 -0
- package/esm/fsm-api-ts/lib/constants.d.ts +15 -0
- package/esm/fsm-api-ts/lib/constants.js +11 -0
- package/esm/fsm-api-ts/lib/create-app.d.ts +19 -0
- package/esm/fsm-api-ts/lib/create-app.js +137 -0
- package/esm/fsm-api-ts/lib/create-router.d.ts +3 -0
- package/esm/fsm-api-ts/lib/create-router.js +10 -0
- package/esm/fsm-api-ts/lib/license.d.ts +13 -0
- package/esm/fsm-api-ts/lib/license.js +15 -0
- package/esm/fsm-api-ts/lib/types.d.ts +19 -0
- package/esm/fsm-api-ts/lib/types.js +1 -0
- package/esm/fsm-api-ts/logger.d.ts +3 -0
- package/esm/fsm-api-ts/logger.js +20 -0
- package/esm/fsm-api-ts/middlewares/api-key-auth.d.ts +34 -0
- package/esm/fsm-api-ts/middlewares/api-key-auth.js +70 -0
- package/esm/fsm-api-ts/middlewares/logtape-logger.d.ts +2 -0
- package/esm/fsm-api-ts/middlewares/logtape-logger.js +33 -0
- package/esm/fsm-api-ts/middlewares/otel-trace.d.ts +2 -0
- package/esm/fsm-api-ts/middlewares/otel-trace.js +29 -0
- package/esm/fsm-api-ts/middlewares/supabase.d.ts +10 -0
- package/esm/fsm-api-ts/middlewares/supabase.js +34 -0
- package/esm/fsm-api-ts/mod.d.ts +2 -0
- package/esm/fsm-api-ts/mod.js +6 -0
- package/esm/fsm-api-ts/routes/admin/admin.handlers.d.ts +8 -0
- package/esm/fsm-api-ts/routes/admin/admin.handlers.js +98 -0
- package/esm/fsm-api-ts/routes/admin/admin.index.d.ts +189 -0
- package/esm/fsm-api-ts/routes/admin/admin.index.js +11 -0
- package/esm/fsm-api-ts/routes/admin/admin.routes.d.ts +473 -0
- package/esm/fsm-api-ts/routes/admin/admin.routes.js +130 -0
- package/esm/fsm-api-ts/routes/definitions/definitions.handlers.d.ts +5 -0
- package/esm/fsm-api-ts/routes/definitions/definitions.handlers.js +29 -0
- package/esm/fsm-api-ts/routes/definitions/definitions.index.d.ts +86 -0
- package/esm/fsm-api-ts/routes/definitions/definitions.index.js +8 -0
- package/esm/fsm-api-ts/routes/definitions/definitions.routes.d.ts +204 -0
- package/esm/fsm-api-ts/routes/definitions/definitions.routes.js +56 -0
- package/esm/fsm-api-ts/routes/index.route.d.ts +19 -0
- package/esm/fsm-api-ts/routes/index.route.js +31 -0
- package/esm/fsm-api-ts/routes/instances/instances.handlers.d.ts +8 -0
- package/esm/fsm-api-ts/routes/instances/instances.handlers.js +108 -0
- package/esm/fsm-api-ts/routes/instances/instances.index.d.ts +237 -0
- package/esm/fsm-api-ts/routes/instances/instances.index.js +11 -0
- package/esm/fsm-api-ts/routes/instances/instances.routes.d.ts +411 -0
- package/esm/fsm-api-ts/routes/instances/instances.routes.js +104 -0
- package/esm/fsm-api-ts/src/cli/index.d.ts +2 -0
- package/esm/fsm-api-ts/src/cli/index.js +197 -0
- package/esm/fsm-api-ts/src/cli/invocation.node.d.ts +1 -0
- package/esm/fsm-api-ts/src/cli/invocation.node.js +4 -0
- package/esm/fsm-api-ts/src/cli/key-bootstrap.d.ts +14 -0
- package/esm/fsm-api-ts/src/cli/key-bootstrap.js +35 -0
- package/esm/fsm-api-ts/src/cli/serve.node.d.ts +6 -0
- package/esm/fsm-api-ts/src/cli/serve.node.js +20 -0
- package/esm/fsm-api-ts/src/cli/version.node.d.ts +1 -0
- package/esm/fsm-api-ts/src/cli/version.node.js +2 -0
- package/esm/fsm-api-ts/stoker-src/http-status-codes.d.ts +354 -0
- package/esm/fsm-api-ts/stoker-src/http-status-codes.js +356 -0
- package/esm/fsm-api-ts/stoker-src/http-status-phrases.d.ts +354 -0
- package/esm/fsm-api-ts/stoker-src/http-status-phrases.js +356 -0
- package/esm/fsm-api-ts/stoker-src/middlewares/index.d.ts +3 -0
- package/esm/fsm-api-ts/stoker-src/middlewares/index.js +3 -0
- package/esm/fsm-api-ts/stoker-src/middlewares/not-found.d.ts +3 -0
- package/esm/fsm-api-ts/stoker-src/middlewares/not-found.js +8 -0
- package/esm/fsm-api-ts/stoker-src/middlewares/on-error.d.ts +3 -0
- package/esm/fsm-api-ts/stoker-src/middlewares/on-error.js +19 -0
- package/esm/fsm-api-ts/stoker-src/middlewares/serve-emoji-favicon.d.ts +3 -0
- package/esm/fsm-api-ts/stoker-src/middlewares/serve-emoji-favicon.js +10 -0
- package/esm/fsm-api-ts/stoker-src/openapi/default-hook.d.ts +3 -0
- package/esm/fsm-api-ts/stoker-src/openapi/default-hook.js +11 -0
- package/esm/fsm-api-ts/stoker-src/openapi/helpers/index.d.ts +4 -0
- package/esm/fsm-api-ts/stoker-src/openapi/helpers/index.js +4 -0
- package/esm/fsm-api-ts/stoker-src/openapi/helpers/json-content-one-of.d.ts +12 -0
- package/esm/fsm-api-ts/stoker-src/openapi/helpers/json-content-one-of.js +14 -0
- package/esm/fsm-api-ts/stoker-src/openapi/helpers/json-content-required.d.ts +11 -0
- package/esm/fsm-api-ts/stoker-src/openapi/helpers/json-content-required.js +8 -0
- package/esm/fsm-api-ts/stoker-src/openapi/helpers/json-content.d.ts +10 -0
- package/esm/fsm-api-ts/stoker-src/openapi/helpers/json-content.js +11 -0
- package/esm/fsm-api-ts/stoker-src/openapi/helpers/one-of.d.ts +3 -0
- package/esm/fsm-api-ts/stoker-src/openapi/helpers/one-of.js +13 -0
- package/esm/fsm-api-ts/stoker-src/openapi/helpers/types.d.ts +2 -0
- package/esm/fsm-api-ts/stoker-src/openapi/helpers/types.js +1 -0
- package/esm/fsm-api-ts/stoker-src/openapi/index.d.ts +3 -0
- package/esm/fsm-api-ts/stoker-src/openapi/index.js +3 -0
- package/esm/fsm-api-ts/stoker-src/openapi/schemas/create-error-schema.d.ts +56 -0
- package/esm/fsm-api-ts/stoker-src/openapi/schemas/create-error-schema.js +25 -0
- package/esm/fsm-api-ts/stoker-src/openapi/schemas/create-message-object.d.ts +9 -0
- package/esm/fsm-api-ts/stoker-src/openapi/schemas/create-message-object.js +11 -0
- package/esm/fsm-api-ts/stoker-src/openapi/schemas/id-params.d.ts +9 -0
- package/esm/fsm-api-ts/stoker-src/openapi/schemas/id-params.js +13 -0
- package/esm/fsm-api-ts/stoker-src/openapi/schemas/id-uuid-params.d.ts +9 -0
- package/esm/fsm-api-ts/stoker-src/openapi/schemas/id-uuid-params.js +13 -0
- package/esm/fsm-api-ts/stoker-src/openapi/schemas/index.d.ts +5 -0
- package/esm/fsm-api-ts/stoker-src/openapi/schemas/index.js +5 -0
- package/esm/fsm-api-ts/stoker-src/openapi/schemas/slug-params.d.ts +9 -0
- package/esm/fsm-api-ts/stoker-src/openapi/schemas/slug-params.js +18 -0
- package/esm/fsm-core-db-ts/src/database.types.d.ts +4 -0
- package/esm/fsm-core-db-ts/src/database.types.js +17 -0
- package/esm/package.json +3 -0
- package/package.json +45 -3
- package/script/_dnt.polyfills.d.ts +17 -0
- package/script/_dnt.polyfills.js +16 -0
- package/script/_dnt.shims.d.ts +5 -0
- package/script/_dnt.shims.js +65 -0
- package/script/fsm-api-ts/mod.d.ts +2 -0
- package/script/fsm-api-ts/mod.js +10 -0
- package/script/fsm-api-ts/src/cli/version.node.d.ts +1 -0
- package/script/fsm-api-ts/src/cli/version.node.js +5 -0
- package/script/package.json +3 -0
- package/README.md +0 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
declare const createMessageObjectSchema: (exampleMessage?: string) => z.ZodObject<{
|
|
3
|
+
message: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
message: string;
|
|
6
|
+
}, {
|
|
7
|
+
message: string;
|
|
8
|
+
}>;
|
|
9
|
+
export default createMessageObjectSchema;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
const createMessageObjectSchema = (exampleMessage = "Hello World") => {
|
|
3
|
+
return z.object({
|
|
4
|
+
message: z.string(),
|
|
5
|
+
}).openapi({
|
|
6
|
+
example: {
|
|
7
|
+
message: exampleMessage,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
export default createMessageObjectSchema;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
const IdUUIDParamsSchema = z.object({
|
|
3
|
+
id: z.string().uuid().openapi({
|
|
4
|
+
param: {
|
|
5
|
+
name: "id",
|
|
6
|
+
in: "path",
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
required: ["id"],
|
|
10
|
+
example: "4651e634-a530-4484-9b09-9616a28f35e3",
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
export default IdUUIDParamsSchema;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as createErrorSchema } from "./create-error-schema.js";
|
|
2
|
+
export { default as createMessageObjectSchema } from "./create-message-object.js";
|
|
3
|
+
export { default as IdParamsSchema } from "./id-params.js";
|
|
4
|
+
export { default as IdUUIDParamsSchema } from "./id-uuid-params.js";
|
|
5
|
+
export { default as SlugParamsSchema } from "./slug-params.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as createErrorSchema } from "./create-error-schema.js";
|
|
2
|
+
export { default as createMessageObjectSchema } from "./create-message-object.js";
|
|
3
|
+
export { default as IdParamsSchema } from "./id-params.js";
|
|
4
|
+
export { default as IdUUIDParamsSchema } from "./id-uuid-params.js";
|
|
5
|
+
export { default as SlugParamsSchema } from "./slug-params.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
// Regular expression to validate slug format: alphanumeric, underscores, and dashes
|
|
3
|
+
const slugReg = /^[\w-]+$/;
|
|
4
|
+
const SLUG_ERROR_MESSAGE = "Slug can only contain letters, numbers, dashes, and underscores";
|
|
5
|
+
const SlugParamsSchema = z.object({
|
|
6
|
+
slug: z.string()
|
|
7
|
+
.regex(slugReg, SLUG_ERROR_MESSAGE)
|
|
8
|
+
.openapi({
|
|
9
|
+
param: {
|
|
10
|
+
name: "slug",
|
|
11
|
+
in: "path",
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
required: ["slug"],
|
|
15
|
+
example: "my-cool-article",
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
export default SlugParamsSchema;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Database as DatabaseGenerated } from "../../database-src/generated/database.types.js";
|
|
2
|
+
import type { Json as JsonGenerated } from "../../database-src/generated/database.types.js";
|
|
3
|
+
export type Json = JsonGenerated | any;
|
|
4
|
+
export type Database = DatabaseGenerated;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
// Override the type for a specific column in a view:
|
|
3
|
+
// export type Database = MergeDeep<
|
|
4
|
+
// DatabaseGenerated,
|
|
5
|
+
// {
|
|
6
|
+
// public: {
|
|
7
|
+
// Views: {
|
|
8
|
+
// movies_view: {
|
|
9
|
+
// Row: {
|
|
10
|
+
// // id is a primary key in public.movies, so it must be `not null`
|
|
11
|
+
// id: number
|
|
12
|
+
// }
|
|
13
|
+
// }
|
|
14
|
+
// }
|
|
15
|
+
// }
|
|
16
|
+
// }
|
|
17
|
+
// >
|
package/esm/package.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgfsm/api",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "pgfsm REST API (pgfsm-api): FSM instances, definitions, API keys and the scheduler over HTTP, in front of fsm_core",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/pgfsm/fsm.git",
|
|
8
|
+
"directory": "packages/fsm-api-ts"
|
|
9
|
+
},
|
|
10
|
+
"license": "AGPL-3.0-only",
|
|
11
|
+
"main": "./script/fsm-api-ts/mod.js",
|
|
12
|
+
"module": "./esm/fsm-api-ts/mod.js",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./esm/fsm-api-ts/mod.js",
|
|
16
|
+
"require": "./script/fsm-api-ts/mod.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {},
|
|
20
|
+
"bin": {
|
|
21
|
+
"pgfsm-api": "./esm/fsm-api-ts/src/cli/index.js"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@asteasolutions/zod-to-openapi": "^7.3.2",
|
|
25
|
+
"@hono/node-server": "^1.14.0",
|
|
26
|
+
"@hono/zod-openapi": "0.19.9",
|
|
27
|
+
"@logtape/hono": "^2.2",
|
|
28
|
+
"@logtape/logtape": "^2.2",
|
|
29
|
+
"@opentelemetry/api": "^1",
|
|
30
|
+
"@pgfsm/db": "^0.8.0",
|
|
31
|
+
"@pgfsm/logging": "^0.2.1",
|
|
32
|
+
"@scalar/hono-api-reference": "^0.9.1",
|
|
33
|
+
"@supabase/ssr": "^0.6.1",
|
|
34
|
+
"@supabase/supabase-js": "^2.49.8",
|
|
35
|
+
"@types/pg": "^8.18.0",
|
|
36
|
+
"dotenv": "^16.5.0",
|
|
37
|
+
"hono": "^4.13.20",
|
|
38
|
+
"pg": "^8.20.0",
|
|
39
|
+
"type-fest": "^5.5.0",
|
|
40
|
+
"zod": "^3.25.30",
|
|
41
|
+
"@deno/shim-deno": "~0.18.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^20.9.0",
|
|
45
|
+
"@types/pg": "^8.18.0"
|
|
46
|
+
},
|
|
47
|
+
"_generatedBy": "dnt@0.43.1"
|
|
6
48
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Error {
|
|
3
|
+
cause?: unknown;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export {};
|
|
7
|
+
declare global {
|
|
8
|
+
interface Object {
|
|
9
|
+
/**
|
|
10
|
+
* Determines whether an object has a property with the specified name.
|
|
11
|
+
* @param o An object.
|
|
12
|
+
* @param v A property name.
|
|
13
|
+
*/
|
|
14
|
+
hasOwn(o: object, v: PropertyKey): boolean;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
|
|
4
|
+
if (!Object.hasOwn) {
|
|
5
|
+
Object.defineProperty(Object, "hasOwn", {
|
|
6
|
+
value: function (object, property) {
|
|
7
|
+
if (object == null) {
|
|
8
|
+
throw new TypeError("Cannot convert undefined or null to object");
|
|
9
|
+
}
|
|
10
|
+
return Object.prototype.hasOwnProperty.call(Object(object), property);
|
|
11
|
+
},
|
|
12
|
+
configurable: true,
|
|
13
|
+
enumerable: false,
|
|
14
|
+
writable: true,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dntGlobalThis = exports.Deno = void 0;
|
|
4
|
+
const shim_deno_1 = require("@deno/shim-deno");
|
|
5
|
+
var shim_deno_2 = require("@deno/shim-deno");
|
|
6
|
+
Object.defineProperty(exports, "Deno", { enumerable: true, get: function () { return shim_deno_2.Deno; } });
|
|
7
|
+
const dntGlobals = {
|
|
8
|
+
Deno: shim_deno_1.Deno,
|
|
9
|
+
};
|
|
10
|
+
exports.dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
11
|
+
function createMergeProxy(baseObj, extObj) {
|
|
12
|
+
return new Proxy(baseObj, {
|
|
13
|
+
get(_target, prop, _receiver) {
|
|
14
|
+
if (prop in extObj) {
|
|
15
|
+
return extObj[prop];
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return baseObj[prop];
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
set(_target, prop, value) {
|
|
22
|
+
if (prop in extObj) {
|
|
23
|
+
delete extObj[prop];
|
|
24
|
+
}
|
|
25
|
+
baseObj[prop] = value;
|
|
26
|
+
return true;
|
|
27
|
+
},
|
|
28
|
+
deleteProperty(_target, prop) {
|
|
29
|
+
let success = false;
|
|
30
|
+
if (prop in extObj) {
|
|
31
|
+
delete extObj[prop];
|
|
32
|
+
success = true;
|
|
33
|
+
}
|
|
34
|
+
if (prop in baseObj) {
|
|
35
|
+
delete baseObj[prop];
|
|
36
|
+
success = true;
|
|
37
|
+
}
|
|
38
|
+
return success;
|
|
39
|
+
},
|
|
40
|
+
ownKeys(_target) {
|
|
41
|
+
const baseKeys = Reflect.ownKeys(baseObj);
|
|
42
|
+
const extKeys = Reflect.ownKeys(extObj);
|
|
43
|
+
const extKeysSet = new Set(extKeys);
|
|
44
|
+
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
45
|
+
},
|
|
46
|
+
defineProperty(_target, prop, desc) {
|
|
47
|
+
if (prop in extObj) {
|
|
48
|
+
delete extObj[prop];
|
|
49
|
+
}
|
|
50
|
+
Reflect.defineProperty(baseObj, prop, desc);
|
|
51
|
+
return true;
|
|
52
|
+
},
|
|
53
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
54
|
+
if (prop in extObj) {
|
|
55
|
+
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
has(_target, prop) {
|
|
62
|
+
return prop in extObj || prop in baseObj;
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PACKAGE_VERSION = void 0;
|
|
4
|
+
// @pgfsm/api's library export (SPEC-016, #689): the package is mainly the
|
|
5
|
+
// `pgfsm-api` bin (src/cli/index.ts). This exports its version only;
|
|
6
|
+
// createApp() reads the process environment at import (env.ts), so it isn't
|
|
7
|
+
// a library entry point.
|
|
8
|
+
require("../_dnt.polyfills.js");
|
|
9
|
+
var version_node_js_1 = require("./src/cli/version.node.js");
|
|
10
|
+
Object.defineProperty(exports, "PACKAGE_VERSION", { enumerable: true, get: function () { return version_node_js_1.PACKAGE_VERSION; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PACKAGE_VERSION: string;
|
package/README.md
DELETED