@checkstack/queue-common 0.0.2
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/CHANGELOG.md +23 -0
- package/package.json +25 -0
- package/src/index.ts +10 -0
- package/src/permissions.ts +11 -0
- package/src/plugin-metadata.ts +9 -0
- package/src/routes.ts +8 -0
- package/src/rpc-contract.ts +43 -0
- package/src/schemas.ts +38 -0
- package/tsconfig.json +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @checkstack/queue-common
|
|
2
|
+
|
|
3
|
+
## 0.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d20d274: Initial release of all @checkstack packages. Rebranded from Checkmate to Checkstack with new npm organization @checkstack and domain checkstack.dev.
|
|
8
|
+
- Updated dependencies [d20d274]
|
|
9
|
+
- @checkstack/common@0.0.2
|
|
10
|
+
|
|
11
|
+
## 0.0.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [a65e002]
|
|
16
|
+
- @checkstack/common@0.2.0
|
|
17
|
+
|
|
18
|
+
## 0.0.2
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [ffc28f6]
|
|
23
|
+
- @checkstack/common@0.1.0
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@checkstack/queue-common",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"import": "./src/index.ts"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"typecheck": "tsc --noEmit",
|
|
12
|
+
"lint": "bun run lint:code",
|
|
13
|
+
"lint:code": "eslint . --max-warnings 0"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@checkstack/common": "workspace:*",
|
|
17
|
+
"@orpc/contract": "^1.13.2",
|
|
18
|
+
"zod": "^4.0.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "^5.7.2",
|
|
22
|
+
"@checkstack/tsconfig": "workspace:*",
|
|
23
|
+
"@checkstack/scripts": "workspace:*"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createPermission } from "@checkstack/common";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Permissions for queue settings
|
|
5
|
+
*/
|
|
6
|
+
export const permissions = {
|
|
7
|
+
queueRead: createPermission("queue", "read", "Read Queue Settings"),
|
|
8
|
+
queueManage: createPermission("queue", "manage", "Update Queue Settings"),
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const permissionList = Object.values(permissions);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { definePluginMetadata } from "@checkstack/common";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plugin metadata for the queue plugin.
|
|
5
|
+
* Exported from the common package so both backend and frontend can reference it.
|
|
6
|
+
*/
|
|
7
|
+
export const pluginMetadata = definePluginMetadata({
|
|
8
|
+
pluginId: "queue",
|
|
9
|
+
});
|
package/src/routes.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { createClientDefinition } from "@checkstack/common";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { permissions } from "./permissions";
|
|
5
|
+
import { pluginMetadata } from "./plugin-metadata";
|
|
6
|
+
import {
|
|
7
|
+
QueuePluginDtoSchema,
|
|
8
|
+
QueueConfigurationDtoSchema,
|
|
9
|
+
UpdateQueueConfigurationSchema,
|
|
10
|
+
} from "./schemas";
|
|
11
|
+
|
|
12
|
+
// Permission metadata type
|
|
13
|
+
export interface QueueMetadata {
|
|
14
|
+
permissions?: string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Base builder with metadata support
|
|
18
|
+
const _base = oc.$meta<QueueMetadata>({});
|
|
19
|
+
|
|
20
|
+
// Queue RPC Contract with permission metadata
|
|
21
|
+
export const queueContract = {
|
|
22
|
+
// Queue plugin queries - Read permission
|
|
23
|
+
getPlugins: _base
|
|
24
|
+
.meta({ permissions: [permissions.queueRead.id] })
|
|
25
|
+
.output(z.array(QueuePluginDtoSchema)),
|
|
26
|
+
|
|
27
|
+
getConfiguration: _base
|
|
28
|
+
.meta({ permissions: [permissions.queueRead.id] })
|
|
29
|
+
.output(QueueConfigurationDtoSchema),
|
|
30
|
+
|
|
31
|
+
// Queue configuration updates - Manage permission
|
|
32
|
+
updateConfiguration: _base
|
|
33
|
+
.meta({ permissions: [permissions.queueManage.id] })
|
|
34
|
+
.input(UpdateQueueConfigurationSchema)
|
|
35
|
+
.output(QueueConfigurationDtoSchema),
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Export contract type
|
|
39
|
+
export type QueueContract = typeof queueContract;
|
|
40
|
+
|
|
41
|
+
// Export client definition for type-safe forPlugin usage
|
|
42
|
+
// Use: const client = rpcApi.forPlugin(QueueApi);
|
|
43
|
+
export const QueueApi = createClientDefinition(queueContract, pluginMetadata);
|
package/src/schemas.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* DTO for queue plugin information
|
|
5
|
+
*/
|
|
6
|
+
export const QueuePluginDtoSchema = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
displayName: z.string(),
|
|
9
|
+
description: z.string().optional(),
|
|
10
|
+
configVersion: z.number(),
|
|
11
|
+
configSchema: z.record(z.string(), z.unknown()),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type QueuePluginDto = z.infer<typeof QueuePluginDtoSchema>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* DTO for current queue configuration
|
|
18
|
+
*/
|
|
19
|
+
export const QueueConfigurationDtoSchema = z.object({
|
|
20
|
+
pluginId: z.string(),
|
|
21
|
+
config: z.record(z.string(), z.unknown()),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type QueueConfigurationDto = z.infer<typeof QueueConfigurationDtoSchema>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Schema for updating queue configuration
|
|
28
|
+
*/
|
|
29
|
+
export const UpdateQueueConfigurationSchema = z.object({
|
|
30
|
+
pluginId: z.string().describe("ID of the queue plugin to use"),
|
|
31
|
+
config: z
|
|
32
|
+
.record(z.string(), z.unknown())
|
|
33
|
+
.describe("Plugin-specific configuration"),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export type UpdateQueueConfiguration = z.infer<
|
|
37
|
+
typeof UpdateQueueConfigurationSchema
|
|
38
|
+
>;
|