@classytic/arc 2.1.2 → 2.1.7
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 +6 -5
- package/bin/arc.js +1 -0
- package/dist/{EventTransport-BD2U0BTc.d.mts → EventTransport-BkUDYZEb.d.mts} +1 -2
- package/dist/HookSystem-BsGV-j2l.mjs +1 -2
- package/dist/{ResourceRegistry-DsN4KJjV.mjs → ResourceRegistry-7Ic20ZMw.mjs} +1 -2
- package/dist/adapters/index.d.mts +4 -4
- package/dist/audit/index.d.mts +5 -6
- package/dist/audit/index.mjs +2 -3
- package/dist/audit/mongodb.d.mts +4 -4
- package/dist/audit/mongodb.mjs +1 -1
- package/dist/{audited-C3T5DTUx.mjs → audited-CGdLiSlE.mjs} +1 -2
- package/dist/auth/index.d.mts +6 -7
- package/dist/auth/index.mjs +10 -16
- package/dist/auth/redis-session.d.mts +2 -3
- package/dist/auth/redis-session.mjs +1 -2
- package/dist/{betterAuthOpenApi-BrHKeSAx.mjs → betterAuthOpenApi-DjWDddNc.mjs} +2 -3
- package/dist/cache/index.d.mts +3 -4
- package/dist/cache/index.mjs +4 -5
- package/dist/{caching-Bl28lYsR.mjs → caching-GSDJcA6-.mjs} +1 -2
- package/dist/{circuitBreaker-DeY4FCjs.mjs → circuitBreaker-DYhWBW_D.mjs} +1 -2
- package/dist/cli/commands/describe.d.mts +1 -2
- package/dist/cli/commands/describe.mjs +1 -2
- package/dist/cli/commands/docs.d.mts +1 -2
- package/dist/cli/commands/docs.mjs +3 -4
- package/dist/cli/commands/generate.d.mts +6 -2
- package/dist/cli/commands/generate.mjs +89 -58
- package/dist/cli/commands/init.d.mts +1 -2
- package/dist/cli/commands/init.mjs +15 -19
- package/dist/cli/commands/introspect.d.mts +1 -2
- package/dist/cli/commands/introspect.mjs +2 -3
- package/dist/cli/index.d.mts +1 -2
- package/dist/cli/index.mjs +1 -2
- package/dist/constants-DdXFXQtN.mjs +1 -2
- package/dist/core/index.d.mts +4 -4
- package/dist/core/index.mjs +1 -1
- package/dist/{createApp-CUgNqegw.mjs → createApp-D2D5XXaV.mjs} +9 -10
- package/dist/{defineResource-k0_BDn8v.mjs → defineResource-DZVbwsFb.mjs} +17 -39
- package/dist/discovery/index.d.mts +1 -2
- package/dist/discovery/index.mjs +1 -2
- package/dist/docs/index.d.mts +5 -6
- package/dist/docs/index.mjs +5 -4
- package/dist/{elevation-B_2dRLVP.d.mts → elevation-DGo5shaX.d.mts} +1 -2
- package/dist/{elevation-BRy3yFWT.mjs → elevation-DSTbVvYj.mjs} +4 -4
- package/dist/{errorHandler-C1okiriz.mjs → errorHandler-C3GY3_ow.mjs} +2 -3
- package/dist/{errorHandler-BbcgBmIH.d.mts → errorHandler-CW3OOeYq.d.mts} +2 -3
- package/dist/{errors-ChKiFz62.d.mts → errors-DAWRdiYP.d.mts} +1 -2
- package/dist/{errors-B9bZok84.mjs → errors-DBANPbGr.mjs} +1 -2
- package/dist/{eventPlugin-DGR_B2on.mjs → eventPlugin-BEOvaDqo.mjs} +2 -3
- package/dist/{eventPlugin-CTrLH3mt.d.mts → eventPlugin-H6wDDjGO.d.mts} +2 -3
- package/dist/events/index.d.mts +4 -5
- package/dist/events/index.mjs +2 -3
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis-stream-entry.mjs +1 -2
- package/dist/events/transports/redis.d.mts +2 -3
- package/dist/events/transports/redis.mjs +1 -2
- package/dist/{externalPaths-DlINfKbP.d.mts → externalPaths-SyPF2tgK.d.mts} +1 -2
- package/dist/factory/index.d.mts +8 -9
- package/dist/factory/index.mjs +1 -1
- package/dist/{fastifyAdapter-BkrGrlFi.d.mts → fastifyAdapter-sGkvUvf5.d.mts} +4 -5
- package/dist/{fields-DyaDVX4J.d.mts → fields-Bi_AVKSo.d.mts} +2 -3
- package/dist/{fields-iagOozy0.mjs → fields-CTd_CrKr.mjs} +2 -3
- package/dist/hooks/index.d.mts +3 -3
- package/dist/idempotency/index.d.mts +4 -5
- package/dist/idempotency/index.mjs +1 -2
- package/dist/idempotency/mongodb.d.mts +1 -1
- package/dist/idempotency/mongodb.mjs +1 -2
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/idempotency/redis.mjs +1 -2
- package/dist/index.d.mts +9 -10
- package/dist/index.mjs +7 -8
- package/dist/integrations/event-gateway.d.mts +2 -3
- package/dist/integrations/event-gateway.mjs +2 -3
- package/dist/integrations/jobs.d.mts +1 -2
- package/dist/integrations/jobs.mjs +1 -2
- package/dist/integrations/streamline.d.mts +1 -2
- package/dist/integrations/streamline.mjs +1 -2
- package/dist/integrations/websocket.d.mts +1 -2
- package/dist/integrations/websocket.mjs +1 -2
- package/dist/{interface-B01JvPVc.d.mts → interface-CSNjltAc.d.mts} +1 -2
- package/dist/{interface-Ch8HU9uM.d.mts → interface-Cb2klgid.d.mts} +10 -10
- package/dist/{interface-CZe8IkMf.d.mts → interface-DTbsvIWe.d.mts} +1 -2
- package/dist/{introspectionPlugin-rFdO8ZUa.mjs → introspectionPlugin-B3JkrjwU.mjs} +1 -2
- package/dist/{keys-BqNejWup.mjs → keys-DhqDRxv3.mjs} +1 -2
- package/dist/{logger-Df2O2WsW.mjs → logger-ByrvQWZO.mjs} +1 -2
- package/dist/{memory-cQgelFOj.mjs → memory-B2v7KrCB.mjs} +1 -2
- package/dist/migrations/index.d.mts +1 -2
- package/dist/migrations/index.mjs +1 -2
- package/dist/{mongodb-CGzRbfAK.d.mts → mongodb-ClykrfGo.d.mts} +2 -3
- package/dist/{mongodb-BfJVlUJH.mjs → mongodb-DNKEExbf.mjs} +1 -2
- package/dist/{mongodb-JN-9JA7K.d.mts → mongodb-Dg8O_gvd.d.mts} +2 -3
- package/dist/{openapi-G3Cw7XuM.mjs → openapi-9nB_kiuR.mjs} +5 -4
- package/dist/org/index.d.mts +4 -5
- package/dist/org/index.mjs +1 -2
- package/dist/org/types.d.mts +1 -2
- package/dist/permissions/index.d.mts +5 -6
- package/dist/permissions/index.mjs +7 -7
- package/dist/plugins/index.d.mts +7 -8
- package/dist/plugins/index.mjs +7 -8
- package/dist/plugins/response-cache.d.mts +1 -2
- package/dist/plugins/response-cache.mjs +2 -3
- package/dist/plugins/tracing-entry.d.mts +1 -1
- package/dist/plugins/tracing-entry.mjs +1 -2
- package/dist/{pluralize-CEweyOEm.mjs → pluralize-CM-jZg7p.mjs} +1 -2
- package/dist/policies/index.d.mts +4 -5
- package/dist/policies/index.mjs +1 -2
- package/dist/presets/index.d.mts +4 -5
- package/dist/presets/index.mjs +2 -3
- package/dist/presets/multiTenant.d.mts +4 -5
- package/dist/presets/multiTenant.mjs +1 -2
- package/dist/{presets-DzSMwlKj.d.mts → presets-BTeYbw7h.d.mts} +2 -3
- package/dist/{presets-BITljm96.mjs → presets-CeFtfDR8.mjs} +1 -2
- package/dist/prisma-DJbMt3yf.mjs +1 -2
- package/dist/{prisma-Dg9GoVdj.d.mts → prisma-DQBSSHAB.d.mts} +2 -3
- package/dist/{queryCachePlugin-DMBnp2Q0.mjs → queryCachePlugin-B6R0d4av.mjs} +4 -5
- package/dist/{queryCachePlugin-7THaI5mt.d.mts → queryCachePlugin-Q6SYuHZ6.d.mts} +2 -3
- package/dist/{redis-D-JAeLtm.d.mts → redis-UwjEp8Ea.d.mts} +2 -3
- package/dist/{redis-stream-Bdh_vUU8.d.mts → redis-stream-CBg0upHI.d.mts} +2 -3
- package/dist/registry/index.d.mts +4 -5
- package/dist/registry/index.mjs +2 -2
- package/dist/{requestContext-QQD6ROJc.mjs → requestContext-xi6OKBL-.mjs} +1 -2
- package/dist/{schemaConverter-BwrmWroW.mjs → schemaConverter-Dtg0Kt9T.mjs} +1 -2
- package/dist/schemas/index.d.mts +1 -2
- package/dist/schemas/index.mjs +1 -2
- package/dist/scope/index.d.mts +2 -3
- package/dist/scope/index.mjs +2 -3
- package/dist/{sessionManager-jPKLbHE0.d.mts → sessionManager-D_iEHjQl.d.mts} +1 -2
- package/dist/{sse-B3c3_yZp.mjs → sse-DkqQ1uxb.mjs} +2 -3
- package/dist/testing/index.d.mts +8 -9
- package/dist/testing/index.mjs +3 -4
- package/dist/{tracing-Cc7vVQPp.d.mts → tracing-8CEbhF0w.d.mts} +1 -2
- package/dist/{typeGuards-DhMNLuvU.mjs → typeGuards-DwxA1t_L.mjs} +1 -2
- package/dist/types/index.d.mts +7 -8
- package/dist/types/index.mjs +1 -2
- package/dist/{types-CIgB7UUl.d.mts → types-B0dhNrnd.d.mts} +9 -10
- package/dist/types-Beqn1Un7.mjs +1 -2
- package/dist/types-DelU6kln.mjs +25 -0
- package/dist/{types-aYB4V7uN.d.mts → types-RLkFVgaw.d.mts} +18 -4
- package/dist/utils/index.d.mts +5 -6
- package/dist/utils/index.mjs +4 -4
- package/package.json +1 -1
- package/dist/EventTransport-BD2U0BTc.d.mts.map +0 -1
- package/dist/HookSystem-BsGV-j2l.mjs.map +0 -1
- package/dist/ResourceRegistry-DsN4KJjV.mjs.map +0 -1
- package/dist/audit/index.d.mts.map +0 -1
- package/dist/audit/index.mjs.map +0 -1
- package/dist/audited-C3T5DTUx.mjs.map +0 -1
- package/dist/auth/index.d.mts.map +0 -1
- package/dist/auth/index.mjs.map +0 -1
- package/dist/auth/redis-session.d.mts.map +0 -1
- package/dist/auth/redis-session.mjs.map +0 -1
- package/dist/betterAuthOpenApi-BrHKeSAx.mjs.map +0 -1
- package/dist/cache/index.d.mts.map +0 -1
- package/dist/cache/index.mjs.map +0 -1
- package/dist/caching-Bl28lYsR.mjs.map +0 -1
- package/dist/circuitBreaker-DeY4FCjs.mjs.map +0 -1
- package/dist/cli/commands/describe.d.mts.map +0 -1
- package/dist/cli/commands/describe.mjs.map +0 -1
- package/dist/cli/commands/docs.d.mts.map +0 -1
- package/dist/cli/commands/docs.mjs.map +0 -1
- package/dist/cli/commands/generate.d.mts.map +0 -1
- package/dist/cli/commands/generate.mjs.map +0 -1
- package/dist/cli/commands/init.d.mts.map +0 -1
- package/dist/cli/commands/init.mjs.map +0 -1
- package/dist/cli/commands/introspect.d.mts.map +0 -1
- package/dist/cli/commands/introspect.mjs.map +0 -1
- package/dist/cli/index.d.mts.map +0 -1
- package/dist/cli/index.mjs.map +0 -1
- package/dist/constants-DdXFXQtN.mjs.map +0 -1
- package/dist/createApp-CUgNqegw.mjs.map +0 -1
- package/dist/defineResource-k0_BDn8v.mjs.map +0 -1
- package/dist/discovery/index.d.mts.map +0 -1
- package/dist/discovery/index.mjs.map +0 -1
- package/dist/docs/index.d.mts.map +0 -1
- package/dist/docs/index.mjs.map +0 -1
- package/dist/elevation-BRy3yFWT.mjs.map +0 -1
- package/dist/elevation-B_2dRLVP.d.mts.map +0 -1
- package/dist/errorHandler-BbcgBmIH.d.mts.map +0 -1
- package/dist/errorHandler-C1okiriz.mjs.map +0 -1
- package/dist/errors-B9bZok84.mjs.map +0 -1
- package/dist/errors-ChKiFz62.d.mts.map +0 -1
- package/dist/eventPlugin-CTrLH3mt.d.mts.map +0 -1
- package/dist/eventPlugin-DGR_B2on.mjs.map +0 -1
- package/dist/events/index.d.mts.map +0 -1
- package/dist/events/index.mjs.map +0 -1
- package/dist/events/transports/redis-stream-entry.mjs.map +0 -1
- package/dist/events/transports/redis.d.mts.map +0 -1
- package/dist/events/transports/redis.mjs.map +0 -1
- package/dist/externalPaths-DlINfKbP.d.mts.map +0 -1
- package/dist/factory/index.d.mts.map +0 -1
- package/dist/fastifyAdapter-BkrGrlFi.d.mts.map +0 -1
- package/dist/fields-DyaDVX4J.d.mts.map +0 -1
- package/dist/fields-iagOozy0.mjs.map +0 -1
- package/dist/idempotency/index.d.mts.map +0 -1
- package/dist/idempotency/index.mjs.map +0 -1
- package/dist/idempotency/mongodb.mjs.map +0 -1
- package/dist/idempotency/redis.mjs.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/integrations/event-gateway.d.mts.map +0 -1
- package/dist/integrations/event-gateway.mjs.map +0 -1
- package/dist/integrations/jobs.d.mts.map +0 -1
- package/dist/integrations/jobs.mjs.map +0 -1
- package/dist/integrations/streamline.d.mts.map +0 -1
- package/dist/integrations/streamline.mjs.map +0 -1
- package/dist/integrations/websocket.d.mts.map +0 -1
- package/dist/integrations/websocket.mjs.map +0 -1
- package/dist/interface-B01JvPVc.d.mts.map +0 -1
- package/dist/interface-CZe8IkMf.d.mts.map +0 -1
- package/dist/interface-Ch8HU9uM.d.mts.map +0 -1
- package/dist/introspectionPlugin-rFdO8ZUa.mjs.map +0 -1
- package/dist/keys-BqNejWup.mjs.map +0 -1
- package/dist/logger-Df2O2WsW.mjs.map +0 -1
- package/dist/memory-cQgelFOj.mjs.map +0 -1
- package/dist/migrations/index.d.mts.map +0 -1
- package/dist/migrations/index.mjs.map +0 -1
- package/dist/mongodb-BfJVlUJH.mjs.map +0 -1
- package/dist/mongodb-CGzRbfAK.d.mts.map +0 -1
- package/dist/mongodb-JN-9JA7K.d.mts.map +0 -1
- package/dist/openapi-G3Cw7XuM.mjs.map +0 -1
- package/dist/org/index.d.mts.map +0 -1
- package/dist/org/index.mjs.map +0 -1
- package/dist/org/types.d.mts.map +0 -1
- package/dist/permissions/index.d.mts.map +0 -1
- package/dist/permissions/index.mjs.map +0 -1
- package/dist/plugins/index.d.mts.map +0 -1
- package/dist/plugins/index.mjs.map +0 -1
- package/dist/plugins/response-cache.d.mts.map +0 -1
- package/dist/plugins/response-cache.mjs.map +0 -1
- package/dist/plugins/tracing-entry.mjs.map +0 -1
- package/dist/pluralize-CEweyOEm.mjs.map +0 -1
- package/dist/policies/index.d.mts.map +0 -1
- package/dist/policies/index.mjs.map +0 -1
- package/dist/presets/index.d.mts.map +0 -1
- package/dist/presets/index.mjs.map +0 -1
- package/dist/presets/multiTenant.d.mts.map +0 -1
- package/dist/presets/multiTenant.mjs.map +0 -1
- package/dist/presets-BITljm96.mjs.map +0 -1
- package/dist/presets-DzSMwlKj.d.mts.map +0 -1
- package/dist/prisma-DJbMt3yf.mjs.map +0 -1
- package/dist/prisma-Dg9GoVdj.d.mts.map +0 -1
- package/dist/queryCachePlugin-7THaI5mt.d.mts.map +0 -1
- package/dist/queryCachePlugin-DMBnp2Q0.mjs.map +0 -1
- package/dist/redis-D-JAeLtm.d.mts.map +0 -1
- package/dist/redis-stream-Bdh_vUU8.d.mts.map +0 -1
- package/dist/registry/index.d.mts.map +0 -1
- package/dist/requestContext-QQD6ROJc.mjs.map +0 -1
- package/dist/schemaConverter-BwrmWroW.mjs.map +0 -1
- package/dist/schemas/index.d.mts.map +0 -1
- package/dist/schemas/index.mjs.map +0 -1
- package/dist/scope/index.d.mts.map +0 -1
- package/dist/scope/index.mjs.map +0 -1
- package/dist/sessionManager-jPKLbHE0.d.mts.map +0 -1
- package/dist/sse-B3c3_yZp.mjs.map +0 -1
- package/dist/testing/index.d.mts.map +0 -1
- package/dist/testing/index.mjs.map +0 -1
- package/dist/tracing-Cc7vVQPp.d.mts.map +0 -1
- package/dist/typeGuards-DhMNLuvU.mjs.map +0 -1
- package/dist/types/index.d.mts.map +0 -1
- package/dist/types/index.mjs.map +0 -1
- package/dist/types-Beqn1Un7.mjs.map +0 -1
- package/dist/types-CIgB7UUl.d.mts.map +0 -1
- package/dist/types-aYB4V7uN.d.mts.map +0 -1
- package/dist/utils/index.d.mts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as pluralize } from "../../pluralize-
|
|
1
|
+
import { t as pluralize } from "../../pluralize-CM-jZg7p.mjs";
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
|
|
@@ -12,6 +12,11 @@ import { join } from "node:path";
|
|
|
12
12
|
* - src/resources/product/product.resource.ts
|
|
13
13
|
* - src/resources/product/product.controller.ts
|
|
14
14
|
* - src/resources/product/product.schemas.ts
|
|
15
|
+
*
|
|
16
|
+
* Handles kebab-case names: `arc g r org-profile` generates:
|
|
17
|
+
* - Class names: OrgProfile, OrgProfileRepository
|
|
18
|
+
* - Variable names: orgProfileSchema, orgProfileRepository
|
|
19
|
+
* - File names: org-profile.model.ts, org-profile.repository.ts
|
|
15
20
|
*/
|
|
16
21
|
function readProjectConfig() {
|
|
17
22
|
try {
|
|
@@ -24,10 +29,25 @@ function readProjectConfig() {
|
|
|
24
29
|
function isTypeScriptProject() {
|
|
25
30
|
return existsSync(join(process.cwd(), "tsconfig.json"));
|
|
26
31
|
}
|
|
32
|
+
/** Convert kebab-case to PascalCase: org-profile → OrgProfile */
|
|
33
|
+
function toPascalCase(name) {
|
|
34
|
+
return name.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
35
|
+
}
|
|
36
|
+
/** Convert PascalCase to camelCase: OrgProfile → orgProfile */
|
|
37
|
+
function toCamelCase(pascalName) {
|
|
38
|
+
return pascalName.charAt(0).toLowerCase() + pascalName.slice(1);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Template functions accept:
|
|
42
|
+
* - name: PascalCase class name (e.g., OrgProfile)
|
|
43
|
+
* - fileName: kebab-case for file paths (e.g., org-profile)
|
|
44
|
+
*/
|
|
27
45
|
function getTemplates(ts, config = {}) {
|
|
28
46
|
const isMultiTenant = config.tenant === "multi";
|
|
29
47
|
return {
|
|
30
|
-
model: (name) =>
|
|
48
|
+
model: (name, fileName) => {
|
|
49
|
+
const camel = toCamelCase(name);
|
|
50
|
+
return `/**
|
|
31
51
|
* ${name} Model
|
|
32
52
|
* Generated by Arc CLI
|
|
33
53
|
*/
|
|
@@ -44,7 +64,7 @@ export interface I${name} {
|
|
|
44
64
|
|
|
45
65
|
export type ${name}Document = HydratedDocument<I${name}>;
|
|
46
66
|
` : ""}
|
|
47
|
-
const ${
|
|
67
|
+
const ${camel}Schema = new Schema${ts ? `<I${name}>` : ""}(
|
|
48
68
|
{
|
|
49
69
|
name: { type: String, required: true, trim: true },
|
|
50
70
|
description: { type: String, trim: true },
|
|
@@ -54,13 +74,16 @@ const ${name.toLowerCase()}Schema = new Schema${ts ? `<I${name}>` : ""}(
|
|
|
54
74
|
);
|
|
55
75
|
|
|
56
76
|
// Indexes
|
|
57
|
-
${
|
|
58
|
-
${
|
|
77
|
+
${camel}Schema.index({ name: 1 });
|
|
78
|
+
${camel}Schema.index({ isActive: 1 });
|
|
59
79
|
|
|
60
|
-
const ${name} = mongoose.models.${name} || mongoose.model('${name}', ${
|
|
80
|
+
const ${name} = mongoose.models.${name} || mongoose.model('${name}', ${camel}Schema);
|
|
61
81
|
export default ${name};
|
|
62
|
-
|
|
63
|
-
|
|
82
|
+
`;
|
|
83
|
+
},
|
|
84
|
+
repository: (name, fileName) => {
|
|
85
|
+
const camel = toCamelCase(name);
|
|
86
|
+
return `/**
|
|
64
87
|
* ${name} Repository
|
|
65
88
|
* Generated by Arc CLI
|
|
66
89
|
*/
|
|
@@ -71,7 +94,7 @@ import {
|
|
|
71
94
|
softDeletePlugin,
|
|
72
95
|
mongoOperationsPlugin,
|
|
73
96
|
} from '@classytic/mongokit';
|
|
74
|
-
import ${name} from './${
|
|
97
|
+
import ${name} from './${fileName}.model.js';
|
|
75
98
|
|
|
76
99
|
class ${name}Repository extends Repository {
|
|
77
100
|
constructor() {
|
|
@@ -90,11 +113,14 @@ class ${name}Repository extends Repository {
|
|
|
90
113
|
}
|
|
91
114
|
}
|
|
92
115
|
|
|
93
|
-
const ${
|
|
94
|
-
export default ${
|
|
116
|
+
const ${camel}Repository = new ${name}Repository();
|
|
117
|
+
export default ${camel}Repository;
|
|
95
118
|
export { ${name}Repository };
|
|
96
|
-
|
|
97
|
-
|
|
119
|
+
`;
|
|
120
|
+
},
|
|
121
|
+
controller: (name, fileName) => {
|
|
122
|
+
const camel = toCamelCase(name);
|
|
123
|
+
return `/**
|
|
98
124
|
* ${name} Controller
|
|
99
125
|
* Generated by Arc CLI
|
|
100
126
|
*
|
|
@@ -103,27 +129,28 @@ export { ${name}Repository };
|
|
|
103
129
|
*/
|
|
104
130
|
|
|
105
131
|
import { BaseController } from '@classytic/arc';
|
|
106
|
-
import ${
|
|
132
|
+
import ${camel}Repository from './${fileName}.repository.js';
|
|
107
133
|
|
|
108
134
|
class ${name}Controller extends BaseController {
|
|
109
135
|
constructor() {
|
|
110
|
-
super(${
|
|
111
|
-
resourceName: '${
|
|
136
|
+
super(${camel}Repository, {
|
|
137
|
+
resourceName: '${fileName}',
|
|
112
138
|
});
|
|
113
139
|
}
|
|
114
140
|
|
|
115
141
|
// Add custom controller methods here
|
|
116
142
|
}
|
|
117
143
|
|
|
118
|
-
const ${
|
|
119
|
-
export default ${
|
|
120
|
-
|
|
121
|
-
|
|
144
|
+
const ${camel}Controller = new ${name}Controller();
|
|
145
|
+
export default ${camel}Controller;
|
|
146
|
+
`;
|
|
147
|
+
},
|
|
148
|
+
schemas: (name, fileName) => `/**
|
|
122
149
|
* ${name} Schemas
|
|
123
150
|
* Generated by Arc CLI
|
|
124
151
|
*/
|
|
125
152
|
|
|
126
|
-
import ${name} from './${
|
|
153
|
+
import ${name} from './${fileName}.model.js';
|
|
127
154
|
import { buildCrudSchemasFromModel } from '@classytic/mongokit/utils';
|
|
128
155
|
|
|
129
156
|
/**
|
|
@@ -145,7 +172,8 @@ const crudSchemas = buildCrudSchemasFromModel(${name}, {
|
|
|
145
172
|
|
|
146
173
|
export default crudSchemas;
|
|
147
174
|
`,
|
|
148
|
-
resource: (name) => {
|
|
175
|
+
resource: (name, fileName) => {
|
|
176
|
+
const camel = toCamelCase(name);
|
|
149
177
|
const useMongoKit = config.adapter === "mongokit" || !config.adapter;
|
|
150
178
|
const queryParserImport = useMongoKit ? `\nimport { QueryParser } from '@classytic/mongokit';\n\nconst queryParser = new QueryParser();\n` : "";
|
|
151
179
|
const queryParserConfig = useMongoKit ? `\n queryParser,` : "";
|
|
@@ -155,24 +183,24 @@ export default crudSchemas;
|
|
|
155
183
|
*/
|
|
156
184
|
|
|
157
185
|
import { defineResource, createMongooseAdapter } from '@classytic/arc';
|
|
158
|
-
import {
|
|
159
|
-
import ${name}${ts ? `, { type I${name} }` : ""} from './${
|
|
160
|
-
import ${
|
|
186
|
+
import { requireAuth, requireRoles } from '@classytic/arc/permissions';
|
|
187
|
+
import ${name}${ts ? `, { type I${name} }` : ""} from './${fileName}.model.js';
|
|
188
|
+
import ${camel}Repository from './${fileName}.repository.js';${queryParserImport}
|
|
161
189
|
|
|
162
|
-
const ${
|
|
163
|
-
name: '${
|
|
164
|
-
adapter: createMongooseAdapter(${name}, ${
|
|
190
|
+
const ${camel}Resource = defineResource${ts ? `<I${name}>` : ""}({
|
|
191
|
+
name: '${fileName}',
|
|
192
|
+
adapter: createMongooseAdapter(${name}, ${camel}Repository),${queryParserConfig}
|
|
165
193
|
presets: ['softDelete'],
|
|
166
194
|
permissions: {
|
|
167
|
-
list:
|
|
168
|
-
get:
|
|
169
|
-
create:
|
|
170
|
-
update:
|
|
171
|
-
delete:
|
|
195
|
+
list: requireAuth(),
|
|
196
|
+
get: requireAuth(),
|
|
197
|
+
create: requireRoles(['admin']),
|
|
198
|
+
update: requireRoles(['admin']),
|
|
199
|
+
delete: requireRoles(['admin']),
|
|
172
200
|
},
|
|
173
201
|
});
|
|
174
202
|
|
|
175
|
-
export default ${
|
|
203
|
+
export default ${camel}Resource;
|
|
176
204
|
` : `/**
|
|
177
205
|
* ${name} Resource
|
|
178
206
|
* Generated by Arc CLI
|
|
@@ -180,12 +208,12 @@ export default ${name.toLowerCase()}Resource;
|
|
|
180
208
|
|
|
181
209
|
import { defineResource, createMongooseAdapter } from '@classytic/arc';
|
|
182
210
|
import { requireAuth, requireRoles } from '@classytic/arc/permissions';
|
|
183
|
-
import ${name}${ts ? `, { type I${name} }` : ""} from './${
|
|
184
|
-
import ${
|
|
211
|
+
import ${name}${ts ? `, { type I${name} }` : ""} from './${fileName}.model.js';
|
|
212
|
+
import ${camel}Repository from './${fileName}.repository.js';${queryParserImport}
|
|
185
213
|
|
|
186
|
-
const ${
|
|
187
|
-
name: '${
|
|
188
|
-
adapter: createMongooseAdapter(${name}, ${
|
|
214
|
+
const ${camel}Resource = defineResource${ts ? `<I${name}>` : ""}({
|
|
215
|
+
name: '${fileName}',
|
|
216
|
+
adapter: createMongooseAdapter(${name}, ${camel}Repository),${queryParserConfig}
|
|
189
217
|
presets: ['softDelete'],
|
|
190
218
|
permissions: {
|
|
191
219
|
list: requireAuth(),
|
|
@@ -196,10 +224,12 @@ const ${name.toLowerCase()}Resource = defineResource${ts ? `<I${name}>` : ""}({
|
|
|
196
224
|
},
|
|
197
225
|
});
|
|
198
226
|
|
|
199
|
-
export default ${
|
|
227
|
+
export default ${camel}Resource;
|
|
200
228
|
`;
|
|
201
229
|
},
|
|
202
|
-
test: (name) =>
|
|
230
|
+
test: (name, fileName) => {
|
|
231
|
+
const camel = toCamelCase(name);
|
|
232
|
+
return `/**
|
|
203
233
|
* ${name} Tests
|
|
204
234
|
* Generated by Arc CLI
|
|
205
235
|
*/
|
|
@@ -207,7 +237,7 @@ export default ${name.toLowerCase()}Resource;
|
|
|
207
237
|
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
208
238
|
import mongoose from 'mongoose';
|
|
209
239
|
import { createMinimalTestApp } from '@classytic/arc/testing';
|
|
210
|
-
${ts ? "import type { FastifyInstance } from 'fastify';\n" : ""}import ${
|
|
240
|
+
${ts ? "import type { FastifyInstance } from 'fastify';\n" : ""}import ${camel}Resource from '../src/resources/${fileName}/${fileName}.resource.js';
|
|
211
241
|
|
|
212
242
|
describe('${name} Resource', () => {
|
|
213
243
|
let app${ts ? ": FastifyInstance" : ""};
|
|
@@ -217,7 +247,7 @@ describe('${name} Resource', () => {
|
|
|
217
247
|
await mongoose.connect(testDbUri);
|
|
218
248
|
|
|
219
249
|
app = createMinimalTestApp();
|
|
220
|
-
await app.register(${
|
|
250
|
+
await app.register(${camel}Resource.toPlugin());
|
|
221
251
|
await app.ready();
|
|
222
252
|
});
|
|
223
253
|
|
|
@@ -226,11 +256,11 @@ describe('${name} Resource', () => {
|
|
|
226
256
|
await mongoose.connection.close();
|
|
227
257
|
});
|
|
228
258
|
|
|
229
|
-
describe('GET /${pluralize(
|
|
259
|
+
describe('GET /${pluralize(fileName)}', () => {
|
|
230
260
|
it('should return a list', async () => {
|
|
231
261
|
const response = await app.inject({
|
|
232
262
|
method: 'GET',
|
|
233
|
-
url: '/${pluralize(
|
|
263
|
+
url: '/${pluralize(fileName)}',
|
|
234
264
|
});
|
|
235
265
|
|
|
236
266
|
expect(response.statusCode).toBe(200);
|
|
@@ -239,7 +269,8 @@ describe('${name} Resource', () => {
|
|
|
239
269
|
});
|
|
240
270
|
});
|
|
241
271
|
});
|
|
242
|
-
|
|
272
|
+
`;
|
|
273
|
+
}
|
|
243
274
|
};
|
|
244
275
|
}
|
|
245
276
|
/**
|
|
@@ -249,7 +280,7 @@ async function generate(type, args) {
|
|
|
249
280
|
if (!type) throw new Error("Missing type argument\nUsage: arc generate <resource|controller|model|repository|schemas> <name>");
|
|
250
281
|
const [name] = args;
|
|
251
282
|
if (!name) throw new Error("Missing name argument\nUsage: arc generate <type> <name>\nExample: arc generate resource product");
|
|
252
|
-
const capitalizedName =
|
|
283
|
+
const capitalizedName = toPascalCase(name);
|
|
253
284
|
const lowerName = name.toLowerCase();
|
|
254
285
|
const projectConfig = readProjectConfig();
|
|
255
286
|
const ts = projectConfig.typescript ?? isTypeScriptProject();
|
|
@@ -290,9 +321,9 @@ async function generateResource(name, lowerName, resourcePath, templates, ext) {
|
|
|
290
321
|
console.log(` + Created: src/resources/${lowerName}/`);
|
|
291
322
|
}
|
|
292
323
|
const files = {
|
|
293
|
-
[`${lowerName}.model.${ext}`]: templates.model(name),
|
|
294
|
-
[`${lowerName}.repository.${ext}`]: templates.repository(name),
|
|
295
|
-
[`${lowerName}.resource.${ext}`]: templates.resource(name)
|
|
324
|
+
[`${lowerName}.model.${ext}`]: templates.model(name, lowerName),
|
|
325
|
+
[`${lowerName}.repository.${ext}`]: templates.repository(name, lowerName),
|
|
326
|
+
[`${lowerName}.resource.${ext}`]: templates.resource(name, lowerName)
|
|
296
327
|
};
|
|
297
328
|
for (const [filename, content] of Object.entries(files)) {
|
|
298
329
|
const filepath = join(resourcePath, filename);
|
|
@@ -306,9 +337,10 @@ async function generateResource(name, lowerName, resourcePath, templates, ext) {
|
|
|
306
337
|
if (!existsSync(testsDir)) mkdirSync(testsDir, { recursive: true });
|
|
307
338
|
const testPath = join(testsDir, `${lowerName}.test.${ext}`);
|
|
308
339
|
if (!existsSync(testPath)) {
|
|
309
|
-
writeFileSync(testPath, templates.test(name));
|
|
340
|
+
writeFileSync(testPath, templates.test(name, lowerName));
|
|
310
341
|
console.log(` + Created: tests/${lowerName}.test.${ext}`);
|
|
311
342
|
}
|
|
343
|
+
const camel = toCamelCase(name);
|
|
312
344
|
const isMultiTenant = readProjectConfig().tenant === "multi";
|
|
313
345
|
console.log(`
|
|
314
346
|
╔═══════════════════════════════════════════════════════════════╗
|
|
@@ -318,19 +350,19 @@ async function generateResource(name, lowerName, resourcePath, templates, ext) {
|
|
|
318
350
|
Next steps:
|
|
319
351
|
|
|
320
352
|
1. Register in src/resources/index.${ext}:
|
|
321
|
-
import ${
|
|
353
|
+
import ${camel}Resource from './${lowerName}/${lowerName}.resource.js';
|
|
322
354
|
|
|
323
355
|
export const resources = [
|
|
324
356
|
// ... existing resources
|
|
325
|
-
${
|
|
357
|
+
${camel}Resource,
|
|
326
358
|
];
|
|
327
359
|
|
|
328
360
|
2. Customize the model schema in:
|
|
329
361
|
src/resources/${lowerName}/${lowerName}.model.${ext}
|
|
330
362
|
|
|
331
363
|
3. Adjust permissions in ${lowerName}.resource.${ext}:
|
|
332
|
-
${isMultiTenant ? ` -
|
|
333
|
-
-
|
|
364
|
+
${isMultiTenant ? ` - requireAuth() → any authenticated user
|
|
365
|
+
- requireRoles(['admin']) → specific platform roles` : ` - requireAuth() → any authenticated user
|
|
334
366
|
- requireRoles(['admin']) → specific platform roles`}
|
|
335
367
|
|
|
336
368
|
4. Run tests:
|
|
@@ -349,10 +381,9 @@ async function generateFile(name, lowerName, resourcePath, fileType, template, e
|
|
|
349
381
|
const filename = `${lowerName}.${fileType}.${ext}`;
|
|
350
382
|
const filepath = join(resourcePath, filename);
|
|
351
383
|
if (existsSync(filepath)) throw new Error(`${filename} already exists. Remove it first or use a different name.`);
|
|
352
|
-
writeFileSync(filepath, template(name));
|
|
384
|
+
writeFileSync(filepath, template(name, lowerName));
|
|
353
385
|
console.log(` + Created: ${filename}`);
|
|
354
386
|
}
|
|
355
387
|
|
|
356
388
|
//#endregion
|
|
357
|
-
export { generate as default, generate };
|
|
358
|
-
//# sourceMappingURL=generate.mjs.map
|
|
389
|
+
export { generate as default, generate };
|
|
@@ -260,23 +260,20 @@ function packageJsonTemplate(config) {
|
|
|
260
260
|
test: "vitest run",
|
|
261
261
|
"test:watch": "vitest"
|
|
262
262
|
};
|
|
263
|
-
const imports = config.typescript ? {
|
|
264
|
-
"#config/*": "./dist/config/*",
|
|
265
|
-
"#shared/*": "./dist/shared/*",
|
|
266
|
-
"#resources/*": "./dist/resources/*",
|
|
267
|
-
"#plugins/*": "./dist/plugins/*"
|
|
268
|
-
} : {
|
|
269
|
-
"#config/*": "./src/config/*",
|
|
270
|
-
"#shared/*": "./src/shared/*",
|
|
271
|
-
"#resources/*": "./src/resources/*",
|
|
272
|
-
"#plugins/*": "./src/plugins/*"
|
|
273
|
-
};
|
|
274
263
|
return JSON.stringify({
|
|
275
264
|
name: config.name,
|
|
276
265
|
version: "1.0.0",
|
|
277
266
|
type: "module",
|
|
278
267
|
main: config.typescript ? "dist/index.js" : "src/index.js",
|
|
279
|
-
imports
|
|
268
|
+
imports: {
|
|
269
|
+
"#config/*": "./src/config/*",
|
|
270
|
+
"#shared/*": "./src/shared/*",
|
|
271
|
+
"#resources/*": "./src/resources/*",
|
|
272
|
+
"#plugins/*": "./src/plugins/*",
|
|
273
|
+
"#services/*": "./src/services/*",
|
|
274
|
+
"#lib/*": "./src/lib/*",
|
|
275
|
+
"#utils/*": "./src/utils/*"
|
|
276
|
+
},
|
|
280
277
|
scripts,
|
|
281
278
|
engines: { node: ">=20" }
|
|
282
279
|
}, null, 2);
|
|
@@ -1201,7 +1198,7 @@ export const requireSuperadmin = ()${returnType} =>
|
|
|
1201
1198
|
* - requireOrgMembership() — just checks if user is in the org (any role)
|
|
1202
1199
|
* - requireTeamMembership() — checks if user is in the active team
|
|
1203
1200
|
*
|
|
1204
|
-
* These are DIFFERENT from platform-level helpers above (requireRoles checks user.
|
|
1201
|
+
* These are DIFFERENT from platform-level helpers above (requireRoles checks user.role).
|
|
1205
1202
|
* Platform superadmin automatically bypasses all org role checks.
|
|
1206
1203
|
*
|
|
1207
1204
|
* IMPORTANT: When using Better Auth's Access Control (ac) with custom roles,
|
|
@@ -1219,13 +1216,13 @@ import {
|
|
|
1219
1216
|
export { requireOrgMembership, requireOrgRole, requireTeamMembership };
|
|
1220
1217
|
|
|
1221
1218
|
/**
|
|
1222
|
-
* Require organization owner (checks member.role, not user.
|
|
1219
|
+
* Require organization owner (checks member.role, not user.role)
|
|
1223
1220
|
*/
|
|
1224
1221
|
export const requireOrgOwner = ()${returnType} =>
|
|
1225
1222
|
requireOrgRole(['owner']);
|
|
1226
1223
|
|
|
1227
1224
|
/**
|
|
1228
|
-
* Require organization manager or higher (checks member.role, not user.
|
|
1225
|
+
* Require organization manager or higher (checks member.role, not user.role)
|
|
1229
1226
|
*/
|
|
1230
1227
|
export const requireOrgManager = ()${returnType} =>
|
|
1231
1228
|
requireOrgRole(['manager', 'admin', 'owner']);
|
|
@@ -2236,11 +2233,11 @@ export async function login(request${ts ? ": FastifyRequest" : ""}, reply${ts ?
|
|
|
2236
2233
|
return reply.code(401).send({ success: false, message: 'Invalid credentials' });
|
|
2237
2234
|
}
|
|
2238
2235
|
|
|
2239
|
-
const tokens = request.server.auth.issueTokens({ id: user._id.toString(),
|
|
2236
|
+
const tokens = request.server.auth.issueTokens({ id: user._id.toString(), role: user.role });
|
|
2240
2237
|
|
|
2241
2238
|
return reply.send({
|
|
2242
2239
|
success: true,
|
|
2243
|
-
user: { id: user._id, name: user.name, email: user.email,
|
|
2240
|
+
user: { id: user._id, name: user.name, email: user.email, role: user.role },
|
|
2244
2241
|
...tokens,
|
|
2245
2242
|
});
|
|
2246
2243
|
} catch (error) {
|
|
@@ -2612,5 +2609,4 @@ Documentation:
|
|
|
2612
2609
|
}
|
|
2613
2610
|
|
|
2614
2611
|
//#endregion
|
|
2615
|
-
export { init as default, init };
|
|
2616
|
-
//# sourceMappingURL=init.mjs.map
|
|
2612
|
+
export { init as default, init };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ResourceRegistry } from "../../ResourceRegistry-
|
|
1
|
+
import { t as ResourceRegistry } from "../../ResourceRegistry-7Ic20ZMw.mjs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
|
|
@@ -72,5 +72,4 @@ async function introspect(args) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
//#endregion
|
|
75
|
-
export { introspect as default, introspect };
|
|
76
|
-
//# sourceMappingURL=introspect.mjs.map
|
|
75
|
+
export { introspect as default, introspect };
|
package/dist/cli/index.d.mts
CHANGED
|
@@ -13,5 +13,4 @@ import introspect from "./commands/introspect.mjs";
|
|
|
13
13
|
*/
|
|
14
14
|
declare function doctor(_args?: string[]): Promise<void>;
|
|
15
15
|
//#endregion
|
|
16
|
-
export { describe, doctor, exportDocs, generate, init, introspect };
|
|
17
|
-
//# sourceMappingURL=index.d.mts.map
|
|
16
|
+
export { describe, doctor, exportDocs, generate, init, introspect };
|
package/dist/cli/index.mjs
CHANGED
|
@@ -81,5 +81,4 @@ const RESERVED_QUERY_PARAMS = Object.freeze(new Set([
|
|
|
81
81
|
]));
|
|
82
82
|
|
|
83
83
|
//#endregion
|
|
84
|
-
export { DEFAULT_SORT as a, HOOK_OPERATIONS as c, MAX_REGEX_LENGTH as d, MAX_SEARCH_LENGTH as f, SYSTEM_FIELDS as h, DEFAULT_MAX_LIMIT as i, HOOK_PHASES as l, RESERVED_QUERY_PARAMS as m, DEFAULT_ID_FIELD as n, DEFAULT_TENANT_FIELD as o, MUTATION_OPERATIONS as p, DEFAULT_LIMIT as r, DEFAULT_UPDATE_METHOD as s, CRUD_OPERATIONS as t, MAX_FILTER_DEPTH as u };
|
|
85
|
-
//# sourceMappingURL=constants-DdXFXQtN.mjs.map
|
|
84
|
+
export { DEFAULT_SORT as a, HOOK_OPERATIONS as c, MAX_REGEX_LENGTH as d, MAX_SEARCH_LENGTH as f, SYSTEM_FIELDS as h, DEFAULT_MAX_LIMIT as i, HOOK_PHASES as l, RESERVED_QUERY_PARAMS as m, DEFAULT_ID_FIELD as n, DEFAULT_TENANT_FIELD as o, MUTATION_OPERATIONS as p, DEFAULT_LIMIT as r, DEFAULT_UPDATE_METHOD as s, CRUD_OPERATIONS as t, MAX_FILTER_DEPTH as u };
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../elevation-
|
|
2
|
-
import { E as defineResource, T as ResourceDefinition, c as BaseController, d as QueryResolverConfig, f as BodySanitizer, h as AccessControlConfig, l as BaseControllerOptions, m as AccessControl, p as BodySanitizerConfig, u as QueryResolver } from "../interface-
|
|
3
|
-
import "../types-
|
|
4
|
-
import { A as createCrudRouter, C as MutationOperation, D as ActionRouterConfig, E as ActionHandler, O as IdempotencyService, S as MUTATION_OPERATIONS, T as SYSTEM_FIELDS, _ as HookOperation, a as getControllerScope, b as MAX_REGEX_LENGTH, c as CrudOperation, d as DEFAULT_MAX_LIMIT, f as DEFAULT_SORT, g as HOOK_PHASES, h as HOOK_OPERATIONS, i as getControllerContext, j as createPermissionMiddleware, k as createActionRouter, l as DEFAULT_ID_FIELD, m as DEFAULT_UPDATE_METHOD, n as createFastifyHandler, o as sendControllerResponse, p as DEFAULT_TENANT_FIELD, r as createRequestContext, s as CRUD_OPERATIONS, t as createCrudHandlers, u as DEFAULT_LIMIT, v as HookPhase, w as RESERVED_QUERY_PARAMS, x as MAX_SEARCH_LENGTH, y as MAX_FILTER_DEPTH } from "../fastifyAdapter-
|
|
1
|
+
import "../elevation-DGo5shaX.mjs";
|
|
2
|
+
import { E as defineResource, T as ResourceDefinition, c as BaseController, d as QueryResolverConfig, f as BodySanitizer, h as AccessControlConfig, l as BaseControllerOptions, m as AccessControl, p as BodySanitizerConfig, u as QueryResolver } from "../interface-Cb2klgid.mjs";
|
|
3
|
+
import "../types-RLkFVgaw.mjs";
|
|
4
|
+
import { A as createCrudRouter, C as MutationOperation, D as ActionRouterConfig, E as ActionHandler, O as IdempotencyService, S as MUTATION_OPERATIONS, T as SYSTEM_FIELDS, _ as HookOperation, a as getControllerScope, b as MAX_REGEX_LENGTH, c as CrudOperation, d as DEFAULT_MAX_LIMIT, f as DEFAULT_SORT, g as HOOK_PHASES, h as HOOK_OPERATIONS, i as getControllerContext, j as createPermissionMiddleware, k as createActionRouter, l as DEFAULT_ID_FIELD, m as DEFAULT_UPDATE_METHOD, n as createFastifyHandler, o as sendControllerResponse, p as DEFAULT_TENANT_FIELD, r as createRequestContext, s as CRUD_OPERATIONS, t as createCrudHandlers, u as DEFAULT_LIMIT, v as HookPhase, w as RESERVED_QUERY_PARAMS, x as MAX_SEARCH_LENGTH, y as MAX_FILTER_DEPTH } from "../fastifyAdapter-sGkvUvf5.mjs";
|
|
5
5
|
export { AccessControl, type AccessControlConfig, type ActionHandler, type ActionRouterConfig, BaseController, type BaseControllerOptions, BodySanitizer, type BodySanitizerConfig, CRUD_OPERATIONS, CrudOperation, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, HookOperation, HookPhase, type IdempotencyService, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, MutationOperation, QueryResolver, type QueryResolverConfig, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, createActionRouter, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineResource, getControllerContext, getControllerScope, sendControllerResponse };
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as DEFAULT_SORT, c as HOOK_OPERATIONS, d as MAX_REGEX_LENGTH, f as MAX_SEARCH_LENGTH, h as SYSTEM_FIELDS, i as DEFAULT_MAX_LIMIT, l as HOOK_PHASES, m as RESERVED_QUERY_PARAMS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MUTATION_OPERATIONS, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as MAX_FILTER_DEPTH } from "../constants-DdXFXQtN.mjs";
|
|
2
|
-
import { _ as QueryResolver, c as createPermissionMiddleware, d as createFastifyHandler, f as createRequestContext, g as BaseController, h as sendControllerResponse, m as getControllerScope, n as defineResource, o as createActionRouter, p as getControllerContext, s as createCrudRouter, t as ResourceDefinition, u as createCrudHandlers, v as BodySanitizer, y as AccessControl } from "../defineResource-
|
|
2
|
+
import { _ as QueryResolver, c as createPermissionMiddleware, d as createFastifyHandler, f as createRequestContext, g as BaseController, h as sendControllerResponse, m as getControllerScope, n as defineResource, o as createActionRouter, p as getControllerContext, s as createCrudRouter, t as ResourceDefinition, u as createCrudHandlers, v as BodySanitizer, y as AccessControl } from "../defineResource-DZVbwsFb.mjs";
|
|
3
3
|
|
|
4
4
|
export { AccessControl, BaseController, BodySanitizer, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, QueryResolver, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, createActionRouter, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineResource, getControllerContext, getControllerScope, sendControllerResponse };
|
|
@@ -276,7 +276,7 @@ async function loadPlugin(name, logger) {
|
|
|
276
276
|
*/
|
|
277
277
|
async function createApp(options) {
|
|
278
278
|
if (options.debug !== void 0 && options.debug !== false) {
|
|
279
|
-
const { configureArcLogger } = await import("./logger-
|
|
279
|
+
const { configureArcLogger } = await import("./logger-ByrvQWZO.mjs").then((n) => n.r);
|
|
280
280
|
configureArcLogger({ debug: options.debug });
|
|
281
281
|
}
|
|
282
282
|
const authConfig = options.auth;
|
|
@@ -404,7 +404,7 @@ async function createApp(options) {
|
|
|
404
404
|
};
|
|
405
405
|
trackPlugin("arc-core");
|
|
406
406
|
if (config.arcPlugins?.events !== false) {
|
|
407
|
-
const { default: eventPlugin } = await import("./eventPlugin-
|
|
407
|
+
const { default: eventPlugin } = await import("./eventPlugin-BEOvaDqo.mjs").then((n) => n.n);
|
|
408
408
|
const eventOpts = typeof config.arcPlugins?.events === "object" ? config.arcPlugins.events : {};
|
|
409
409
|
await fastify.register(eventPlugin, {
|
|
410
410
|
...eventOpts,
|
|
@@ -429,16 +429,16 @@ async function createApp(options) {
|
|
|
429
429
|
fastify.log.debug("Arc gracefulShutdown plugin enabled");
|
|
430
430
|
}
|
|
431
431
|
if (config.arcPlugins?.caching) {
|
|
432
|
-
const { default: cachingPlugin } = await import("./caching-
|
|
432
|
+
const { default: cachingPlugin } = await import("./caching-GSDJcA6-.mjs").then((n) => n.r);
|
|
433
433
|
const cachingOpts = config.arcPlugins.caching === true ? {} : config.arcPlugins.caching;
|
|
434
434
|
await fastify.register(cachingPlugin, cachingOpts);
|
|
435
435
|
trackPlugin("arc-caching", cachingOpts);
|
|
436
436
|
fastify.log.debug("Arc caching plugin enabled");
|
|
437
437
|
}
|
|
438
438
|
if (config.arcPlugins?.queryCache) {
|
|
439
|
-
const { queryCachePlugin } = await import("./queryCachePlugin-
|
|
439
|
+
const { queryCachePlugin } = await import("./queryCachePlugin-B6R0d4av.mjs").then((n) => n.n);
|
|
440
440
|
const qcOpts = config.arcPlugins.queryCache === true ? {} : config.arcPlugins.queryCache;
|
|
441
|
-
const store = options.stores?.queryCache ?? new (await (import("./memory-
|
|
441
|
+
const store = options.stores?.queryCache ?? new (await (import("./memory-B2v7KrCB.mjs").then((n) => n.n))).MemoryCacheStore();
|
|
442
442
|
await fastify.register(queryCachePlugin, {
|
|
443
443
|
store,
|
|
444
444
|
...qcOpts
|
|
@@ -448,7 +448,7 @@ async function createApp(options) {
|
|
|
448
448
|
}
|
|
449
449
|
if (config.arcPlugins?.sse) if (config.arcPlugins?.events === false) fastify.log.warn("SSE plugin requires events plugin (arcPlugins.events). SSE disabled.");
|
|
450
450
|
else {
|
|
451
|
-
const { default: ssePlugin } = await import("./sse-
|
|
451
|
+
const { default: ssePlugin } = await import("./sse-DkqQ1uxb.mjs").then((n) => n.r);
|
|
452
452
|
const sseOpts = config.arcPlugins.sse === true ? {} : config.arcPlugins.sse;
|
|
453
453
|
await fastify.register(ssePlugin, sseOpts);
|
|
454
454
|
trackPlugin("arc-sse", sseOpts);
|
|
@@ -492,13 +492,13 @@ async function createApp(options) {
|
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
if (config.elevation) {
|
|
495
|
-
const { elevationPlugin } = await import("./elevation-
|
|
495
|
+
const { elevationPlugin } = await import("./elevation-DSTbVvYj.mjs").then((n) => n.r);
|
|
496
496
|
await fastify.register(elevationPlugin, config.elevation);
|
|
497
497
|
trackPlugin("arc-elevation", config.elevation);
|
|
498
498
|
fastify.log.debug("Elevation plugin enabled");
|
|
499
499
|
}
|
|
500
500
|
if (config.errorHandler !== false) {
|
|
501
|
-
const { errorHandlerPlugin } = await import("./errorHandler-
|
|
501
|
+
const { errorHandlerPlugin } = await import("./errorHandler-C3GY3_ow.mjs").then((n) => n.n);
|
|
502
502
|
const errorOpts = typeof config.errorHandler === "object" ? config.errorHandler : { includeStack: config.preset !== "production" };
|
|
503
503
|
await fastify.register(errorHandlerPlugin, errorOpts);
|
|
504
504
|
trackPlugin("arc-error-handler", errorOpts);
|
|
@@ -556,5 +556,4 @@ const ArcFactory = {
|
|
|
556
556
|
};
|
|
557
557
|
|
|
558
558
|
//#endregion
|
|
559
|
-
export { getPreset as a, developmentPreset as i, createApp as n, productionPreset as o, createApp_exports as r, testingPreset as s, ArcFactory as t };
|
|
560
|
-
//# sourceMappingURL=createApp-CUgNqegw.mjs.map
|
|
559
|
+
export { getPreset as a, developmentPreset as i, createApp as n, productionPreset as o, createApp_exports as r, testingPreset as s, ArcFactory as t };
|