@prisma-next/operations 0.3.0-pr.93.5 → 0.3.0-pr.94.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/dist/index.d.mts +32 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +28 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +13 -8
- package/dist/index.d.ts +0 -29
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -37
- package/dist/index.js.map +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
2
|
+
type ArgSpec = {
|
|
3
|
+
readonly kind: 'typeId';
|
|
4
|
+
readonly type: string;
|
|
5
|
+
} | {
|
|
6
|
+
readonly kind: 'param';
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: 'literal';
|
|
9
|
+
};
|
|
10
|
+
type ReturnSpec = {
|
|
11
|
+
readonly kind: 'typeId';
|
|
12
|
+
readonly type: string;
|
|
13
|
+
} | {
|
|
14
|
+
readonly kind: 'builtin';
|
|
15
|
+
readonly type: 'number' | 'boolean' | 'string';
|
|
16
|
+
};
|
|
17
|
+
interface OperationSignature {
|
|
18
|
+
readonly forTypeId: string;
|
|
19
|
+
readonly method: string;
|
|
20
|
+
readonly args: ReadonlyArray<ArgSpec>;
|
|
21
|
+
readonly returns: ReturnSpec;
|
|
22
|
+
readonly capabilities?: ReadonlyArray<string>;
|
|
23
|
+
}
|
|
24
|
+
interface OperationRegistry {
|
|
25
|
+
register(op: OperationSignature): void;
|
|
26
|
+
byType(typeId: string): ReadonlyArray<OperationSignature>;
|
|
27
|
+
}
|
|
28
|
+
declare function createOperationRegistry(): OperationRegistry;
|
|
29
|
+
declare function hasAllCapabilities(capabilities: ReadonlyArray<string>, contractCapabilities?: Record<string, Record<string, boolean>>): boolean;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ArgSpec, OperationRegistry, OperationSignature, ReturnSpec, createOperationRegistry, hasAllCapabilities };
|
|
32
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";KAAY,OAAA;EAAA,SAAA,IAAO,EAAA,QAAA;EAKP,SAAA,IAAU,EAAA,MAAA;AAItB,CAAA,GAAiB;EAGc,SAAA,IAAA,EAAA,OAAA;CAAd,GAAA;EACG,SAAA,IAAA,EAAA,SAAA;CACM;AAAa,KAT3B,UAAA,GAS2B;EAGtB,SAAA,IAAA,EAAA,QAAiB;EACnB,SAAA,IAAA,EAAA,MAAA;CACyB,GAAA;EAAd,SAAA,IAAA,EAAA,SAAA;EAAa,SAAA,IAAA,EAAA,QAAA,GAAA,SAAA,GAAA,QAAA;AAuBvC,CAAA;AAIgB,UArCC,kBAAA,CAqCiB;EAClB,SAAA,SAAA,EAAA,MAAA;EACwB,SAAA,MAAA,EAAA,MAAA;EAAf,SAAA,IAAA,EApCR,aAoCQ,CApCM,OAoCN,CAAA;EAAM,SAAA,OAAA,EAnCX,UAmCW;0BAlCL;;UAGT,iBAAA;eACF;0BACW,cAAc;;iBAuBxB,uBAAA,CAAA,GAA2B;iBAI3B,kBAAA,eACA,8CACS,eAAe"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
var OperationRegistryImpl = class {
|
|
3
|
+
operations = /* @__PURE__ */ new Map();
|
|
4
|
+
register(op) {
|
|
5
|
+
const existing = this.operations.get(op.forTypeId) ?? [];
|
|
6
|
+
if (existing.find((existingOp) => existingOp.method === op.method)) throw new Error(`Operation method "${op.method}" already registered for typeId "${op.forTypeId}"`);
|
|
7
|
+
existing.push(op);
|
|
8
|
+
this.operations.set(op.forTypeId, existing);
|
|
9
|
+
}
|
|
10
|
+
byType(typeId) {
|
|
11
|
+
return this.operations.get(typeId) ?? [];
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
function createOperationRegistry() {
|
|
15
|
+
return new OperationRegistryImpl();
|
|
16
|
+
}
|
|
17
|
+
function hasAllCapabilities(capabilities, contractCapabilities) {
|
|
18
|
+
if (!contractCapabilities) return false;
|
|
19
|
+
return capabilities.every((cap) => {
|
|
20
|
+
const [namespace, ...rest] = cap.split(".");
|
|
21
|
+
const key = rest.join(".");
|
|
22
|
+
return (namespace ? contractCapabilities[namespace] : void 0)?.[key] === true;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { createOperationRegistry, hasAllCapabilities };
|
|
28
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export type ArgSpec =\n | { readonly kind: 'typeId'; readonly type: string }\n | { readonly kind: 'param' }\n | { readonly kind: 'literal' };\n\nexport type ReturnSpec =\n | { readonly kind: 'typeId'; readonly type: string }\n | { readonly kind: 'builtin'; readonly type: 'number' | 'boolean' | 'string' };\n\nexport interface OperationSignature {\n readonly forTypeId: string;\n readonly method: string;\n readonly args: ReadonlyArray<ArgSpec>;\n readonly returns: ReturnSpec;\n readonly capabilities?: ReadonlyArray<string>;\n}\n\nexport interface OperationRegistry {\n register(op: OperationSignature): void;\n byType(typeId: string): ReadonlyArray<OperationSignature>;\n}\n\nclass OperationRegistryImpl implements OperationRegistry {\n private readonly operations = new Map<string, OperationSignature[]>();\n\n register(op: OperationSignature): void {\n const existing = this.operations.get(op.forTypeId) ?? [];\n const duplicate = existing.find((existingOp) => existingOp.method === op.method);\n if (duplicate) {\n throw new Error(\n `Operation method \"${op.method}\" already registered for typeId \"${op.forTypeId}\"`,\n );\n }\n existing.push(op);\n this.operations.set(op.forTypeId, existing);\n }\n\n byType(typeId: string): ReadonlyArray<OperationSignature> {\n return this.operations.get(typeId) ?? [];\n }\n}\n\nexport function createOperationRegistry(): OperationRegistry {\n return new OperationRegistryImpl();\n}\n\nexport function hasAllCapabilities(\n capabilities: ReadonlyArray<string>,\n contractCapabilities?: Record<string, Record<string, boolean>>,\n): boolean {\n if (!contractCapabilities) {\n return false;\n }\n\n return capabilities.every((cap) => {\n const [namespace, ...rest] = cap.split('.');\n const key = rest.join('.');\n const namespaceCaps = namespace ? contractCapabilities[namespace] : undefined;\n return namespaceCaps?.[key] === true;\n });\n}\n"],"mappings":";AAsBA,IAAM,wBAAN,MAAyD;CACvD,AAAiB,6BAAa,IAAI,KAAmC;CAErE,SAAS,IAA8B;EACrC,MAAM,WAAW,KAAK,WAAW,IAAI,GAAG,UAAU,IAAI,EAAE;AAExD,MADkB,SAAS,MAAM,eAAe,WAAW,WAAW,GAAG,OAAO,CAE9E,OAAM,IAAI,MACR,qBAAqB,GAAG,OAAO,mCAAmC,GAAG,UAAU,GAChF;AAEH,WAAS,KAAK,GAAG;AACjB,OAAK,WAAW,IAAI,GAAG,WAAW,SAAS;;CAG7C,OAAO,QAAmD;AACxD,SAAO,KAAK,WAAW,IAAI,OAAO,IAAI,EAAE;;;AAI5C,SAAgB,0BAA6C;AAC3D,QAAO,IAAI,uBAAuB;;AAGpC,SAAgB,mBACd,cACA,sBACS;AACT,KAAI,CAAC,qBACH,QAAO;AAGT,QAAO,aAAa,OAAO,QAAQ;EACjC,MAAM,CAAC,WAAW,GAAG,QAAQ,IAAI,MAAM,IAAI;EAC3C,MAAM,MAAM,KAAK,KAAK,IAAI;AAE1B,UADsB,YAAY,qBAAqB,aAAa,UAC7C,SAAS;GAChC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/operations",
|
|
3
|
-
"version": "0.3.0-pr.
|
|
3
|
+
"version": "0.3.0-pr.94.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=20"
|
|
8
|
+
},
|
|
6
9
|
"description": "Target-neutral operation registry and capability helpers for Prisma Next",
|
|
7
10
|
"dependencies": {
|
|
8
|
-
"@prisma-next/plan": "0.3.0-pr.
|
|
11
|
+
"@prisma-next/plan": "0.3.0-pr.94.1"
|
|
9
12
|
},
|
|
10
13
|
"devDependencies": {
|
|
11
|
-
"
|
|
14
|
+
"tsdown": "0.18.4",
|
|
12
15
|
"typescript": "5.9.3",
|
|
13
16
|
"vitest": "4.0.16",
|
|
14
17
|
"@prisma-next/test-utils": "0.0.1",
|
|
18
|
+
"@prisma-next/tsdown": "0.0.0",
|
|
15
19
|
"@prisma-next/tsconfig": "0.0.0"
|
|
16
20
|
},
|
|
17
21
|
"files": [
|
|
@@ -19,13 +23,14 @@
|
|
|
19
23
|
"src"
|
|
20
24
|
],
|
|
21
25
|
"exports": {
|
|
22
|
-
".":
|
|
23
|
-
|
|
24
|
-
"import": "./dist/index.js"
|
|
25
|
-
}
|
|
26
|
+
".": "./dist/index.mjs",
|
|
27
|
+
"./package.json": "./package.json"
|
|
26
28
|
},
|
|
29
|
+
"main": "./dist/index.mjs",
|
|
30
|
+
"module": "./dist/index.mjs",
|
|
31
|
+
"types": "./dist/index.d.mts",
|
|
27
32
|
"scripts": {
|
|
28
|
-
"build": "
|
|
33
|
+
"build": "tsdown",
|
|
29
34
|
"test": "vitest run --passWithNoTests",
|
|
30
35
|
"test:coverage": "vitest run --coverage --passWithNoTests",
|
|
31
36
|
"typecheck": "tsc --noEmit",
|
package/dist/index.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export type ArgSpec = {
|
|
2
|
-
readonly kind: 'typeId';
|
|
3
|
-
readonly type: string;
|
|
4
|
-
} | {
|
|
5
|
-
readonly kind: 'param';
|
|
6
|
-
} | {
|
|
7
|
-
readonly kind: 'literal';
|
|
8
|
-
};
|
|
9
|
-
export type ReturnSpec = {
|
|
10
|
-
readonly kind: 'typeId';
|
|
11
|
-
readonly type: string;
|
|
12
|
-
} | {
|
|
13
|
-
readonly kind: 'builtin';
|
|
14
|
-
readonly type: 'number' | 'boolean' | 'string';
|
|
15
|
-
};
|
|
16
|
-
export interface OperationSignature {
|
|
17
|
-
readonly forTypeId: string;
|
|
18
|
-
readonly method: string;
|
|
19
|
-
readonly args: ReadonlyArray<ArgSpec>;
|
|
20
|
-
readonly returns: ReturnSpec;
|
|
21
|
-
readonly capabilities?: ReadonlyArray<string>;
|
|
22
|
-
}
|
|
23
|
-
export interface OperationRegistry {
|
|
24
|
-
register(op: OperationSignature): void;
|
|
25
|
-
byType(typeId: string): ReadonlyArray<OperationSignature>;
|
|
26
|
-
}
|
|
27
|
-
export declare function createOperationRegistry(): OperationRegistry;
|
|
28
|
-
export declare function hasAllCapabilities(capabilities: ReadonlyArray<string>, contractCapabilities?: Record<string, Record<string, boolean>>): boolean;
|
|
29
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GACf;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEjC,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAA;CAAE,CAAC;AAEjF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACvC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAC3D;AAsBD,wBAAgB,uBAAuB,IAAI,iBAAiB,CAE3D;AAED,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,EACnC,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC7D,OAAO,CAWT"}
|
package/dist/index.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
|
-
var OperationRegistryImpl = class {
|
|
3
|
-
operations = /* @__PURE__ */ new Map();
|
|
4
|
-
register(op) {
|
|
5
|
-
const existing = this.operations.get(op.forTypeId) ?? [];
|
|
6
|
-
const duplicate = existing.find((existingOp) => existingOp.method === op.method);
|
|
7
|
-
if (duplicate) {
|
|
8
|
-
throw new Error(
|
|
9
|
-
`Operation method "${op.method}" already registered for typeId "${op.forTypeId}"`
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
existing.push(op);
|
|
13
|
-
this.operations.set(op.forTypeId, existing);
|
|
14
|
-
}
|
|
15
|
-
byType(typeId) {
|
|
16
|
-
return this.operations.get(typeId) ?? [];
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
function createOperationRegistry() {
|
|
20
|
-
return new OperationRegistryImpl();
|
|
21
|
-
}
|
|
22
|
-
function hasAllCapabilities(capabilities, contractCapabilities) {
|
|
23
|
-
if (!contractCapabilities) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
return capabilities.every((cap) => {
|
|
27
|
-
const [namespace, ...rest] = cap.split(".");
|
|
28
|
-
const key = rest.join(".");
|
|
29
|
-
const namespaceCaps = namespace ? contractCapabilities[namespace] : void 0;
|
|
30
|
-
return namespaceCaps?.[key] === true;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
createOperationRegistry,
|
|
35
|
-
hasAllCapabilities
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type ArgSpec =\n | { readonly kind: 'typeId'; readonly type: string }\n | { readonly kind: 'param' }\n | { readonly kind: 'literal' };\n\nexport type ReturnSpec =\n | { readonly kind: 'typeId'; readonly type: string }\n | { readonly kind: 'builtin'; readonly type: 'number' | 'boolean' | 'string' };\n\nexport interface OperationSignature {\n readonly forTypeId: string;\n readonly method: string;\n readonly args: ReadonlyArray<ArgSpec>;\n readonly returns: ReturnSpec;\n readonly capabilities?: ReadonlyArray<string>;\n}\n\nexport interface OperationRegistry {\n register(op: OperationSignature): void;\n byType(typeId: string): ReadonlyArray<OperationSignature>;\n}\n\nclass OperationRegistryImpl implements OperationRegistry {\n private readonly operations = new Map<string, OperationSignature[]>();\n\n register(op: OperationSignature): void {\n const existing = this.operations.get(op.forTypeId) ?? [];\n const duplicate = existing.find((existingOp) => existingOp.method === op.method);\n if (duplicate) {\n throw new Error(\n `Operation method \"${op.method}\" already registered for typeId \"${op.forTypeId}\"`,\n );\n }\n existing.push(op);\n this.operations.set(op.forTypeId, existing);\n }\n\n byType(typeId: string): ReadonlyArray<OperationSignature> {\n return this.operations.get(typeId) ?? [];\n }\n}\n\nexport function createOperationRegistry(): OperationRegistry {\n return new OperationRegistryImpl();\n}\n\nexport function hasAllCapabilities(\n capabilities: ReadonlyArray<string>,\n contractCapabilities?: Record<string, Record<string, boolean>>,\n): boolean {\n if (!contractCapabilities) {\n return false;\n }\n\n return capabilities.every((cap) => {\n const [namespace, ...rest] = cap.split('.');\n const key = rest.join('.');\n const namespaceCaps = namespace ? contractCapabilities[namespace] : undefined;\n return namespaceCaps?.[key] === true;\n });\n}\n"],"mappings":";AAsBA,IAAM,wBAAN,MAAyD;AAAA,EACtC,aAAa,oBAAI,IAAkC;AAAA,EAEpE,SAAS,IAA8B;AACrC,UAAM,WAAW,KAAK,WAAW,IAAI,GAAG,SAAS,KAAK,CAAC;AACvD,UAAM,YAAY,SAAS,KAAK,CAAC,eAAe,WAAW,WAAW,GAAG,MAAM;AAC/E,QAAI,WAAW;AACb,YAAM,IAAI;AAAA,QACR,qBAAqB,GAAG,MAAM,oCAAoC,GAAG,SAAS;AAAA,MAChF;AAAA,IACF;AACA,aAAS,KAAK,EAAE;AAChB,SAAK,WAAW,IAAI,GAAG,WAAW,QAAQ;AAAA,EAC5C;AAAA,EAEA,OAAO,QAAmD;AACxD,WAAO,KAAK,WAAW,IAAI,MAAM,KAAK,CAAC;AAAA,EACzC;AACF;AAEO,SAAS,0BAA6C;AAC3D,SAAO,IAAI,sBAAsB;AACnC;AAEO,SAAS,mBACd,cACA,sBACS;AACT,MAAI,CAAC,sBAAsB;AACzB,WAAO;AAAA,EACT;AAEA,SAAO,aAAa,MAAM,CAAC,QAAQ;AACjC,UAAM,CAAC,WAAW,GAAG,IAAI,IAAI,IAAI,MAAM,GAAG;AAC1C,UAAM,MAAM,KAAK,KAAK,GAAG;AACzB,UAAM,gBAAgB,YAAY,qBAAqB,SAAS,IAAI;AACpE,WAAO,gBAAgB,GAAG,MAAM;AAAA,EAClC,CAAC;AACH;","names":[]}
|