{"_id":"@flatfile/resources","_rev":"37-0701773a0c645f26595a41b75626280b","name":"@flatfile/resources","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@flatfile/resources","version":"1.0.0","author":"","license":"ISC","_id":"@flatfile/resources@1.0.0","maintainers":[{"name":"mollyalger","email":"molly@flatfile.io"},{"name":"bangarang","email":"me@alexjrock.com"},{"name":"madmandrit","email":"wiafe23@gmail.com"},{"name":"roberto-alcantara-ffile","email":"cicero.roberto@flatfile.io"},{"name":"mairechew","email":"mairechew@gmail.com"},{"name":"jmmander","email":"jmzmander@gmail.com"},{"name":"srmotter","email":"stephen@motter.org"},{"name":"driscollrp","email":"driscollrp@gmail.com"},{"name":"abbywigdale","email":"abby.wigdale@gmail.com"},{"name":"sarocu","email":"sam@sarocu.com"},{"name":"dboskovic","email":"me@david.gs"},{"name":"brentkulwicki","email":"brentkulwicki@gmail.com"},{"name":"nate.ferrero","email":"nateferrero@gmail.com"},{"name":"markpieszak","email":"mpieszak84@gmail.com"},{"name":"robbiet480","email":"me@robbiet.us"},{"name":"jaredwalters","email":"jared@kegstool.com"}],"dist":{"shasum":"4fcdacf5d76c143ecd576712c59ea29a2ffa7acc","tarball":"https://registry.npmjs.org/@flatfile/resources/-/resources-1.0.0.tgz","fileCount":23,"integrity":"sha512-h8BJwPxXntJvD91wOgrs1j00ClxRMN5rbBbQkIzUhbDi4bpF+9OqPDcEo8DSUANOz+TGgf+kJprvg3Lnt9S+tw==","signatures":[{"sig":"MEQCIEnzODI+3zeeU7w3r0TgPgmL0ZjhXmvWpLvO3wJ/V0/rAiB/UzL61F3e4AJKQ2ZDKzpOdgZs7J4ANs/svOMmM/s3Nw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":23627,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjITawACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo5/g//Y2nYJesFme1gVAh/cogcroamlinTsShMZYupet82P5dUKr87\r\nWSgGmEIU4p5oqnb/SrijXUCy3jnvbW2blS4hE2e1GLsRpmPb1gt1M7vAZ30x\r\ngbDf4jR6eAMN+W9yy4W/V2N0dz+qYILR/1QwEcL8EyhG6ea1kuKJ3DNY837U\r\nx3ZWPUfMJ+yPguhj7fsNeAkDnjIvC9BeZObvqIqYWbQRiE4vOtrau9SJYKJ9\r\nuSHpRqtM8oUc73KYmMLXraXf0eH75afOBXF1O7B0Ey6cQpaeVKtIAkLe6nW5\r\n/amze/UlqCJd4Ja1nXU/kcCPD6WGmjbZo96Lfv0DVzh7XoCIMPTdqGmBOGB+\r\nu1c1kPRPeU55aoQ7seGxAmAc2PEUmCTo5EPMjuV0L8zzugIzCVepIFmS9yll\r\n1dPSb2MSaIZxpW0qjY1ZZO9YXe7laK+iiPxNBpCzSm4qi43XzCBIeU7lPf47\r\nS12HTaUa+nKojdrXVOyQ2eDjl8BjhShehqyKFEjzi5XU+Ro6zpAJETy/tVSW\r\nuGU4W+WKpUNGWK1+gUlxXqyAn+PP0SWu9dwckaseaIqpRLYkLfVa8r0JJJs4\r\nyeLFItFCLtZUi6o8+jLm3BEisI+dB0UwRzjnZW2KnCDwiGVyrT/fHUNVuvu6\r\nYlbKFnR7tVp0IojUk42Jlno+JI7J9JZohTk=\r\n=60Ze\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","tsup":{"dts":true,"clean":true,"entry":["src/index.ts"]},"types":"./dist/index.d.ts","gitHead":"081105643478193aa0c4d13bbea7d82c0a33b458","scripts":{"dev":"tsup --watch","test":"jest","build":"tsup","clean":"rm -rf .turbo && rm -rf node_modules && rm -rf dist","format":"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"","coverage":"jest --coverage"},"_npmUser":{"name":"sarocu","email":"sam@sarocu.com"},"_npmVersion":"8.15.0","description":"Utilities for working with resources across our entire API.","directories":{},"_nodeVersion":"16.17.0","dependencies":{"collect.js":"^4.34.3","@flatfile/id":"*"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.3","@flatfile/ts-config-flatfile":"*","@flatfile/jest-preset-flatfile":"*"},"_npmOperationalInternal":{"tmp":"tmp/resources_1.0.0_1663121072085_0.08757907964119993","host":"s3://npm-registry-packages"}}},"time":{"created":"2022-09-14T02:04:32.003Z","modified":"2026-04-23T23:54:53.635Z","1.0.0":"2022-09-14T02:04:32.290Z"},"license":"ISC","description":"Utilities for working with resources across our entire API.","maintainers":[{"email":"sam@sarocu.com","name":"sarocu"},{"email":"me@david.gs","name":"dboskovic"},{"email":"me@alexjrock.com","name":"bangarang"},{"email":"carlbrugger@proton.me","name":"carlbrugger"},{"email":"infra@flatfile.io","name":"flatfileinfra"},{"email":"derek@flatfile.io","name":"flatderek"},{"email":"eric@flatfile.io","name":"bigcountrycrane"},{"email":"matthew.e.mccoy@gmail.com","name":"mmccooyyy"},{"email":"matthew.gerstman@obvious.ai","name":"matthew-obvious"},{"email":"nikolazaris@gmail.com","name":"nlazaris"},{"email":"lion.hummer@gmail.com","name":"lionhummer"},{"email":"alexpoddubny@googlemail.com","name":"apoddubn"}],"readme":"# Utilities for working with API resources\n\nFlow of Fetching inforamtion\n\n- Repository: Generates queries only, produces: Collection<Model>, Model, Primitive (count, etc)\n- Service: Computes, combines, and manipulates data from or into the Repository\n  - Response<Serializable<Entity>>\n  - Response<Collection<Serializable<Entity>>>\n  - Response<Mixed>\n- Controller\n\nResourceCollection implements Scoped, Paginated\n\nScoped -> applyVerifiedScopes()\nFilterable -> applyFilter()\nPaginated\n-> paginate()\n-> paginationSummary()\nResponse ->\n-> data()\n-> meta()\n-> error()\nSerializable -> toAPI(): ApiResponse<T|T[]>\nRequest\n-> Authentication\n-> Authorization\n-> Payload\n-> Arguments\nCreateRequest extends Request\n-> Validation<File>\n-> toModel()\nCreateResponse\n-> 201 Created\n-> Entity\n\nEngine\n-> Driver\n\nExample:\n-> upload a file\n-> POST to Controller\n-> // do stuff with binary file\n-> driver(drive).store() => // path\n-> service.createFile(req: CreateRequest<File>): CreateResponse<File>\n-> repository.insertFile({ file })\n<- Response.toAPI()\n\nFilterable\n\n- show me files uploaded by me\n- show me files uploaded to the primary space\n- show me files with an extracted workbook\n- show me files that have been uploaded to this workbook\n\nAccess in a collection must be a queryable constraint - ID piles are an ANTIPATTERN\n\n- the service must know the different ways it may be considered in an access matrix\n- the following types of constraints must be supported by all\n\n- SCOPE & PERMISSIONS\n  - JWT MUST have verified access to an owning [Scopable] entity (access level never narrows)\n    - workbook: owned by environment, owned by space, authored by user\n  - JWT MAY be granted explicit access to a resource in a way that supercedes all scopes\n    - file: you have been granted write access to this file\n- PERMISSIONS\n  - you must have a verified permission grant on a hierarchal scope\n    - you must always verify your identity and your permissions on at least one hierarchal scope in order to access the data\n    - permissions may not narrow, this ensures that any permission granted on a parent is true of all its children\n- ASSIGNING SCOPABLE ENTITIES\n  - in order to explicitly assign any item as a scope to an entity you must have a verified `read` grant of that entity\n  - when assigning a scope to any entity, all of that entities parents are _implicitly_ assigned\n    - this requires a tree-traversal query on scopes\n\n| scope         | file_id       |\n| ------------- | ------------- |\n| us0_sp_8y498h | us0_fi_8h4uhs |\n| us0_wb_892hsl | us0_fi_8h4uhs |\n\nJWT\n\n```\ngrant us0_sp_8y498h admin\n```\n\nAPI\n\n```\ndrill us0_wb_892hsl\n```\n","readmeFilename":"README.md"}