@mappa-ai/mappa-node 1.2.4 → 2.0.8

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/node.cjs ADDED
@@ -0,0 +1,37 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let node_fs_promises = require("node:fs/promises");
3
+
4
+ //#region src/node.ts
5
+ async function fileFromPath(req) {
6
+ return { file: new Uint8Array(await (0, node_fs_promises.readFile)(req.path)) };
7
+ }
8
+ async function uploadFromPath(client, req) {
9
+ const file = await fileFromPath(req);
10
+ return client.files.upload({
11
+ file: file.file,
12
+ label: req.label,
13
+ idempotencyKey: req.idempotencyKey,
14
+ requestId: req.requestId,
15
+ signal: req.signal
16
+ });
17
+ }
18
+ async function generateReportFromPath(client, req) {
19
+ const file = await fileFromPath(req);
20
+ return client.reports.generateFromFile({
21
+ file: file.file,
22
+ output: req.output,
23
+ target: req.target,
24
+ label: req.label,
25
+ entityLabel: req.entityLabel,
26
+ webhook: req.webhook,
27
+ requestId: req.requestId,
28
+ idempotencyKey: req.idempotencyKey,
29
+ signal: req.signal
30
+ });
31
+ }
32
+
33
+ //#endregion
34
+ exports.fileFromPath = fileFromPath;
35
+ exports.generateReportFromPath = generateReportFromPath;
36
+ exports.uploadFromPath = uploadFromPath;
37
+ //# sourceMappingURL=node.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.cjs","names":[],"sources":["../src/node.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport type { Mappa } from \"./Mappa\";\nimport type {\n\tMediaObject,\n\tReportCreateJobRequest,\n\tReportForOutputType,\n} from \"./types\";\n\nexport type FileFromPathRequest = {\n\tpath: string;\n};\n\nexport type UploadFromPathRequest = FileFromPathRequest & {\n\tlabel?: string;\n\tidempotencyKey?: string;\n\trequestId?: string;\n\tsignal?: AbortSignal;\n};\n\nexport type GenerateReportFromPathRequest = Omit<\n\tReportCreateJobRequest,\n\t\"media\" | \"requestId\" | \"idempotencyKey\" | \"signal\"\n> &\n\tFileFromPathRequest & {\n\t\tlabel?: string;\n\t\trequestId?: string;\n\t\tidempotencyKey?: string;\n\t\tsignal?: AbortSignal;\n\t};\n\nexport async function fileFromPath(req: FileFromPathRequest): Promise<{\n\tfile: Uint8Array;\n}> {\n\tconst file = new Uint8Array(await readFile(req.path));\n\treturn { file };\n}\n\nexport async function uploadFromPath(\n\tclient: Mappa,\n\treq: UploadFromPathRequest,\n): Promise<MediaObject> {\n\tconst file = await fileFromPath(req);\n\treturn client.files.upload({\n\t\tfile: file.file,\n\t\tlabel: req.label,\n\t\tidempotencyKey: req.idempotencyKey,\n\t\trequestId: req.requestId,\n\t\tsignal: req.signal,\n\t});\n}\n\nexport async function generateReportFromPath(\n\tclient: Mappa,\n\treq: GenerateReportFromPathRequest,\n): Promise<ReportForOutputType> {\n\tconst file = await fileFromPath(req);\n\treturn client.reports.generateFromFile({\n\t\tfile: file.file,\n\t\toutput: req.output,\n\t\ttarget: req.target,\n\t\tlabel: req.label,\n\t\tentityLabel: req.entityLabel,\n\t\twebhook: req.webhook,\n\t\trequestId: req.requestId,\n\t\tidempotencyKey: req.idempotencyKey,\n\t\tsignal: req.signal,\n\t});\n}\n"],"mappings":";;;;AA8BA,eAAsB,aAAa,KAEhC;AAEF,QAAO,EAAE,MADI,IAAI,WAAW,qCAAe,IAAI,KAAK,CAAC,EACtC;;AAGhB,eAAsB,eACrB,QACA,KACuB;CACvB,MAAM,OAAO,MAAM,aAAa,IAAI;AACpC,QAAO,OAAO,MAAM,OAAO;EAC1B,MAAM,KAAK;EACX,OAAO,IAAI;EACX,gBAAgB,IAAI;EACpB,WAAW,IAAI;EACf,QAAQ,IAAI;EACZ,CAAC;;AAGH,eAAsB,uBACrB,QACA,KAC+B;CAC/B,MAAM,OAAO,MAAM,aAAa,IAAI;AACpC,QAAO,OAAO,QAAQ,iBAAiB;EACtC,MAAM,KAAK;EACX,QAAQ,IAAI;EACZ,QAAQ,IAAI;EACZ,OAAO,IAAI;EACX,aAAa,IAAI;EACjB,SAAS,IAAI;EACb,WAAW,IAAI;EACf,gBAAgB,IAAI;EACpB,QAAQ,IAAI;EACZ,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { M as ReportCreateJobRequest, N as ReportForOutputType, k as MediaObject, t as Mappa } from "./Mappa-BTrlzSaB.cjs";
2
+
3
+ //#region src/node.d.ts
4
+ type FileFromPathRequest = {
5
+ path: string;
6
+ };
7
+ type UploadFromPathRequest = FileFromPathRequest & {
8
+ label?: string;
9
+ idempotencyKey?: string;
10
+ requestId?: string;
11
+ signal?: AbortSignal;
12
+ };
13
+ type GenerateReportFromPathRequest = Omit<ReportCreateJobRequest, "media" | "requestId" | "idempotencyKey" | "signal"> & FileFromPathRequest & {
14
+ label?: string;
15
+ requestId?: string;
16
+ idempotencyKey?: string;
17
+ signal?: AbortSignal;
18
+ };
19
+ declare function fileFromPath(req: FileFromPathRequest): Promise<{
20
+ file: Uint8Array;
21
+ }>;
22
+ declare function uploadFromPath(client: Mappa, req: UploadFromPathRequest): Promise<MediaObject>;
23
+ declare function generateReportFromPath(client: Mappa, req: GenerateReportFromPathRequest): Promise<ReportForOutputType>;
24
+ //#endregion
25
+ export { FileFromPathRequest, GenerateReportFromPathRequest, UploadFromPathRequest, fileFromPath, generateReportFromPath, uploadFromPath };
26
+ //# sourceMappingURL=node.d.cts.map
@@ -0,0 +1,26 @@
1
+ import { M as ReportCreateJobRequest, N as ReportForOutputType, k as MediaObject, t as Mappa } from "./Mappa-BjTJceWa.mjs";
2
+
3
+ //#region src/node.d.ts
4
+ type FileFromPathRequest = {
5
+ path: string;
6
+ };
7
+ type UploadFromPathRequest = FileFromPathRequest & {
8
+ label?: string;
9
+ idempotencyKey?: string;
10
+ requestId?: string;
11
+ signal?: AbortSignal;
12
+ };
13
+ type GenerateReportFromPathRequest = Omit<ReportCreateJobRequest, "media" | "requestId" | "idempotencyKey" | "signal"> & FileFromPathRequest & {
14
+ label?: string;
15
+ requestId?: string;
16
+ idempotencyKey?: string;
17
+ signal?: AbortSignal;
18
+ };
19
+ declare function fileFromPath(req: FileFromPathRequest): Promise<{
20
+ file: Uint8Array;
21
+ }>;
22
+ declare function uploadFromPath(client: Mappa, req: UploadFromPathRequest): Promise<MediaObject>;
23
+ declare function generateReportFromPath(client: Mappa, req: GenerateReportFromPathRequest): Promise<ReportForOutputType>;
24
+ //#endregion
25
+ export { FileFromPathRequest, GenerateReportFromPathRequest, UploadFromPathRequest, fileFromPath, generateReportFromPath, uploadFromPath };
26
+ //# sourceMappingURL=node.d.mts.map
package/dist/node.mjs ADDED
@@ -0,0 +1,34 @@
1
+ import { readFile } from "node:fs/promises";
2
+
3
+ //#region src/node.ts
4
+ async function fileFromPath(req) {
5
+ return { file: new Uint8Array(await readFile(req.path)) };
6
+ }
7
+ async function uploadFromPath(client, req) {
8
+ const file = await fileFromPath(req);
9
+ return client.files.upload({
10
+ file: file.file,
11
+ label: req.label,
12
+ idempotencyKey: req.idempotencyKey,
13
+ requestId: req.requestId,
14
+ signal: req.signal
15
+ });
16
+ }
17
+ async function generateReportFromPath(client, req) {
18
+ const file = await fileFromPath(req);
19
+ return client.reports.generateFromFile({
20
+ file: file.file,
21
+ output: req.output,
22
+ target: req.target,
23
+ label: req.label,
24
+ entityLabel: req.entityLabel,
25
+ webhook: req.webhook,
26
+ requestId: req.requestId,
27
+ idempotencyKey: req.idempotencyKey,
28
+ signal: req.signal
29
+ });
30
+ }
31
+
32
+ //#endregion
33
+ export { fileFromPath, generateReportFromPath, uploadFromPath };
34
+ //# sourceMappingURL=node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.mjs","names":[],"sources":["../src/node.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport type { Mappa } from \"./Mappa\";\nimport type {\n\tMediaObject,\n\tReportCreateJobRequest,\n\tReportForOutputType,\n} from \"./types\";\n\nexport type FileFromPathRequest = {\n\tpath: string;\n};\n\nexport type UploadFromPathRequest = FileFromPathRequest & {\n\tlabel?: string;\n\tidempotencyKey?: string;\n\trequestId?: string;\n\tsignal?: AbortSignal;\n};\n\nexport type GenerateReportFromPathRequest = Omit<\n\tReportCreateJobRequest,\n\t\"media\" | \"requestId\" | \"idempotencyKey\" | \"signal\"\n> &\n\tFileFromPathRequest & {\n\t\tlabel?: string;\n\t\trequestId?: string;\n\t\tidempotencyKey?: string;\n\t\tsignal?: AbortSignal;\n\t};\n\nexport async function fileFromPath(req: FileFromPathRequest): Promise<{\n\tfile: Uint8Array;\n}> {\n\tconst file = new Uint8Array(await readFile(req.path));\n\treturn { file };\n}\n\nexport async function uploadFromPath(\n\tclient: Mappa,\n\treq: UploadFromPathRequest,\n): Promise<MediaObject> {\n\tconst file = await fileFromPath(req);\n\treturn client.files.upload({\n\t\tfile: file.file,\n\t\tlabel: req.label,\n\t\tidempotencyKey: req.idempotencyKey,\n\t\trequestId: req.requestId,\n\t\tsignal: req.signal,\n\t});\n}\n\nexport async function generateReportFromPath(\n\tclient: Mappa,\n\treq: GenerateReportFromPathRequest,\n): Promise<ReportForOutputType> {\n\tconst file = await fileFromPath(req);\n\treturn client.reports.generateFromFile({\n\t\tfile: file.file,\n\t\toutput: req.output,\n\t\ttarget: req.target,\n\t\tlabel: req.label,\n\t\tentityLabel: req.entityLabel,\n\t\twebhook: req.webhook,\n\t\trequestId: req.requestId,\n\t\tidempotencyKey: req.idempotencyKey,\n\t\tsignal: req.signal,\n\t});\n}\n"],"mappings":";;;AA8BA,eAAsB,aAAa,KAEhC;AAEF,QAAO,EAAE,MADI,IAAI,WAAW,MAAM,SAAS,IAAI,KAAK,CAAC,EACtC;;AAGhB,eAAsB,eACrB,QACA,KACuB;CACvB,MAAM,OAAO,MAAM,aAAa,IAAI;AACpC,QAAO,OAAO,MAAM,OAAO;EAC1B,MAAM,KAAK;EACX,OAAO,IAAI;EACX,gBAAgB,IAAI;EACpB,WAAW,IAAI;EACf,QAAQ,IAAI;EACZ,CAAC;;AAGH,eAAsB,uBACrB,QACA,KAC+B;CAC/B,MAAM,OAAO,MAAM,aAAa,IAAI;AACpC,QAAO,OAAO,QAAQ,iBAAiB;EACtC,MAAM,KAAK;EACX,QAAQ,IAAI;EACZ,QAAQ,IAAI;EACZ,OAAO,IAAI;EACX,aAAa,IAAI;EACjB,SAAS,IAAI;EACb,WAAW,IAAI;EACf,gBAAgB,IAAI;EACpB,QAAQ,IAAI;EACZ,CAAC"}
package/package.json CHANGED
@@ -1,46 +1,62 @@
1
1
  {
2
2
  "name": "@mappa-ai/mappa-node",
3
- "module": "src/index.ts",
4
- "type": "module",
5
- "version": "1.2.4",
3
+ "version": "2.0.8",
4
+ "description": "Official TypeScript/Node SDK for the Mappa API",
6
5
  "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/mappa-ai/behavioral-engine.git",
9
+ "directory": "packages/sdk-ts"
10
+ },
11
+ "homepage": "https://github.com/mappa-ai/behavioral-engine/tree/main/packages/sdk-ts#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/mappa-ai/behavioral-engine/issues"
14
+ },
15
+ "keywords": [
16
+ "mappa",
17
+ "sdk",
18
+ "node",
19
+ "typescript",
20
+ "api",
21
+ "conduit",
22
+ "behavior"
23
+ ],
24
+ "type": "module",
25
+ "sideEffects": false,
7
26
  "files": [
8
- "dist/**"
27
+ "dist"
9
28
  ],
10
29
  "publishConfig": {
11
30
  "access": "public"
12
31
  },
32
+ "main": "./dist/index.cjs",
33
+ "module": "./dist/index.mjs",
34
+ "types": "./dist/index.d.mts",
13
35
  "exports": {
14
36
  ".": {
15
- "import": {
16
- "types": "./dist/index.d.mts",
17
- "default": "./dist/index.mjs"
18
- },
19
- "require": {
20
- "types": "./dist/index.d.cts",
21
- "default": "./dist/index.cjs"
22
- }
37
+ "types": "./dist/index.d.mts",
38
+ "import": "./dist/index.mjs",
39
+ "require": "./dist/index.cjs"
40
+ },
41
+ "./node": {
42
+ "types": "./dist/node.d.mts",
43
+ "import": "./dist/node.mjs",
44
+ "require": "./dist/node.cjs"
23
45
  }
24
46
  },
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com/mappa-ai/mappa-node.git"
28
- },
29
47
  "scripts": {
30
48
  "build": "tsdown",
31
- "typecheck": "tsc --noEmit",
32
- "test": "bun test",
33
- "check": "biome check",
34
- "check:fix": "biome check --fix",
35
- "lazycheck": "bun run check && bun run typecheck && bun run test"
49
+ "type-check": "bunx tsc --noEmit",
50
+ "check": "biome check .",
51
+ "lazycheck": "bun run check && bun run type-check && bun run test",
52
+ "test": "bun test"
36
53
  },
37
54
  "devDependencies": {
38
- "@biomejs/biome": "^2.3.11",
39
- "@types/bun": "^1.3.6",
40
- "tsdown": "^0.19.0",
41
- "typescript": "^5.9.3"
42
- },
43
- "dependencies": {
44
- "@paralleldrive/cuid2": "^3.0.6"
55
+ "@biomejs/biome": "catalog:",
56
+ "@mappa-ai/contracts": "workspace:*",
57
+ "@types/node": "catalog:",
58
+ "bun-types": "catalog:",
59
+ "tsdown": "catalog:",
60
+ "typescript": "catalog:"
45
61
  }
46
62
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Plus Five Five, Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.