@gadicc/loom 0.0.0-oidc-bootstrap.0
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/LICENSE +201 -0
- package/NOTICE +6 -0
- package/README.md +448 -0
- package/THIRD_PARTY_NOTICES.md +25 -0
- package/db/drizzle-config.d.ts +20 -0
- package/db/drizzle-config.js +34 -0
- package/db/fixtures.d.ts +31 -0
- package/db/fixtures.js +52 -0
- package/db/neon.d.ts +3 -0
- package/db/neon.js +20 -0
- package/db/neonFull.d.ts +12 -0
- package/db/neonFull.js +33 -0
- package/db/package.json +3 -0
- package/db/testing.d.ts +26 -0
- package/db/testing.js +76 -0
- package/db/testing.test.ts +28 -0
- package/db/valibot.d.ts +23 -0
- package/db/valibot.js +8 -0
- package/esm/_dnt.polyfills.d.ts +149 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +163 -0
- package/esm/_dnt.shims.d.ts +2 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +57 -0
- package/esm/bin/loom.d.ts +2 -0
- package/esm/bin/loom.d.ts.map +1 -0
- package/esm/bin/loom.js +11 -0
- package/esm/mod.d.ts +9 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +8 -0
- package/esm/package.json +3 -0
- package/esm/src/apiKeys/authorize.d.ts +4 -0
- package/esm/src/apiKeys/authorize.d.ts.map +1 -0
- package/esm/src/apiKeys/authorize.js +184 -0
- package/esm/src/apiKeys/country.d.ts +3 -0
- package/esm/src/apiKeys/country.d.ts.map +1 -0
- package/esm/src/apiKeys/country.js +7 -0
- package/esm/src/apiKeys/credentials.d.ts +4 -0
- package/esm/src/apiKeys/credentials.d.ts.map +1 -0
- package/esm/src/apiKeys/credentials.js +55 -0
- package/esm/src/apiKeys/fingerprint.d.ts +3 -0
- package/esm/src/apiKeys/fingerprint.d.ts.map +1 -0
- package/esm/src/apiKeys/fingerprint.js +5 -0
- package/esm/src/apiKeys/mod.d.ts +9 -0
- package/esm/src/apiKeys/mod.d.ts.map +1 -0
- package/esm/src/apiKeys/mod.js +8 -0
- package/esm/src/apiKeys/policy.d.ts +59 -0
- package/esm/src/apiKeys/policy.d.ts.map +1 -0
- package/esm/src/apiKeys/policy.js +88 -0
- package/esm/src/apiKeys/retention.d.ts +55 -0
- package/esm/src/apiKeys/retention.d.ts.map +1 -0
- package/esm/src/apiKeys/retention.js +65 -0
- package/esm/src/apiKeys/types.d.ts +175 -0
- package/esm/src/apiKeys/types.d.ts.map +1 -0
- package/esm/src/apiKeys/types.js +1 -0
- package/esm/src/cli/externalSkills.d.ts +39 -0
- package/esm/src/cli/externalSkills.d.ts.map +1 -0
- package/esm/src/cli/externalSkills.js +177 -0
- package/esm/src/cli/mod.d.ts +337 -0
- package/esm/src/cli/mod.d.ts.map +1 -0
- package/esm/src/cli/mod.js +9268 -0
- package/esm/src/cli/projectSkills.d.ts +102 -0
- package/esm/src/cli/projectSkills.d.ts.map +1 -0
- package/esm/src/cli/projectSkills.js +592 -0
- package/esm/src/files/client.d.ts +29 -0
- package/esm/src/files/client.d.ts.map +1 -0
- package/esm/src/files/client.js +41 -0
- package/esm/src/files/errors.d.ts +37 -0
- package/esm/src/files/errors.d.ts.map +1 -0
- package/esm/src/files/errors.js +66 -0
- package/esm/src/files/hash.d.ts +15 -0
- package/esm/src/files/hash.d.ts.map +1 -0
- package/esm/src/files/hash.js +82 -0
- package/esm/src/files/memory.d.ts +29 -0
- package/esm/src/files/memory.d.ts.map +1 -0
- package/esm/src/files/memory.js +109 -0
- package/esm/src/files/metadata.d.ts +10 -0
- package/esm/src/files/metadata.d.ts.map +1 -0
- package/esm/src/files/metadata.js +186 -0
- package/esm/src/files/mod.d.ts +10 -0
- package/esm/src/files/mod.d.ts.map +1 -0
- package/esm/src/files/mod.js +9 -0
- package/esm/src/files/s3.d.ts +29 -0
- package/esm/src/files/s3.d.ts.map +1 -0
- package/esm/src/files/s3.js +107 -0
- package/esm/src/files/service.d.ts +27 -0
- package/esm/src/files/service.d.ts.map +1 -0
- package/esm/src/files/service.js +136 -0
- package/esm/src/files/types.d.ts +134 -0
- package/esm/src/files/types.d.ts.map +1 -0
- package/esm/src/files/types.js +1 -0
- package/esm/src/jobs/catalog.d.ts +32 -0
- package/esm/src/jobs/catalog.d.ts.map +1 -0
- package/esm/src/jobs/catalog.js +208 -0
- package/esm/src/jobs/controller.d.ts +28 -0
- package/esm/src/jobs/controller.d.ts.map +1 -0
- package/esm/src/jobs/controller.js +95 -0
- package/esm/src/jobs/direct.d.ts +36 -0
- package/esm/src/jobs/direct.d.ts.map +1 -0
- package/esm/src/jobs/direct.js +122 -0
- package/esm/src/jobs/events.d.ts +15 -0
- package/esm/src/jobs/events.d.ts.map +1 -0
- package/esm/src/jobs/events.js +30 -0
- package/esm/src/jobs/format.d.ts +16 -0
- package/esm/src/jobs/format.d.ts.map +1 -0
- package/esm/src/jobs/format.js +183 -0
- package/esm/src/jobs/http.d.ts +22 -0
- package/esm/src/jobs/http.d.ts.map +1 -0
- package/esm/src/jobs/http.js +44 -0
- package/esm/src/jobs/log.d.ts +2 -0
- package/esm/src/jobs/log.d.ts.map +1 -0
- package/esm/src/jobs/log.js +10 -0
- package/esm/src/jobs/mod.d.ts +10 -0
- package/esm/src/jobs/mod.d.ts.map +1 -0
- package/esm/src/jobs/mod.js +9 -0
- package/esm/src/jobs/run.d.ts +20 -0
- package/esm/src/jobs/run.d.ts.map +1 -0
- package/esm/src/jobs/run.js +57 -0
- package/esm/src/jobs/types.d.ts +31 -0
- package/esm/src/jobs/types.d.ts.map +1 -0
- package/esm/src/jobs/types.js +1 -0
- package/esm/src/mui/apiKeys.d.ts +65 -0
- package/esm/src/mui/apiKeys.d.ts.map +1 -0
- package/esm/src/mui/apiKeys.js +301 -0
- package/esm/src/mui/apiKeysView.d.ts +48 -0
- package/esm/src/mui/apiKeysView.d.ts.map +1 -0
- package/esm/src/mui/apiKeysView.js +34 -0
- package/esm/src/mui/confirm.d.ts +12 -0
- package/esm/src/mui/confirm.d.ts.map +1 -0
- package/esm/src/mui/confirm.js +78 -0
- package/esm/src/mui/mod.d.ts +4 -0
- package/esm/src/mui/mod.d.ts.map +1 -0
- package/esm/src/mui/mod.js +2 -0
- package/esm/src/next/apiKeys/mod.d.ts +64 -0
- package/esm/src/next/apiKeys/mod.d.ts.map +1 -0
- package/esm/src/next/apiKeys/mod.js +217 -0
- package/esm/src/next/auth/config.d.ts +34 -0
- package/esm/src/next/auth/config.d.ts.map +1 -0
- package/esm/src/next/auth/config.js +103 -0
- package/esm/src/next/auth/mod.d.ts +3 -0
- package/esm/src/next/auth/mod.d.ts.map +1 -0
- package/esm/src/next/auth/mod.js +2 -0
- package/esm/src/next/auth/server.d.ts +28 -0
- package/esm/src/next/auth/server.d.ts.map +1 -0
- package/esm/src/next/auth/server.js +24 -0
- package/esm/src/next/files/mod.d.ts +3 -0
- package/esm/src/next/files/mod.d.ts.map +1 -0
- package/esm/src/next/files/mod.js +2 -0
- package/esm/src/next/files/route.d.ts +99 -0
- package/esm/src/next/files/route.d.ts.map +1 -0
- package/esm/src/next/files/route.js +349 -0
- package/esm/src/next/jobs/list.d.ts +25 -0
- package/esm/src/next/jobs/list.d.ts.map +1 -0
- package/esm/src/next/jobs/list.js +39 -0
- package/esm/src/next/jobs/mod.d.ts +6 -0
- package/esm/src/next/jobs/mod.d.ts.map +1 -0
- package/esm/src/next/jobs/mod.js +5 -0
- package/esm/src/next/jobs/paths.d.ts +14 -0
- package/esm/src/next/jobs/paths.d.ts.map +1 -0
- package/esm/src/next/jobs/paths.js +40 -0
- package/esm/src/next/jobs/route.d.ts +48 -0
- package/esm/src/next/jobs/route.d.ts.map +1 -0
- package/esm/src/next/jobs/route.js +101 -0
- package/esm/src/next/jobs/run.d.ts +51 -0
- package/esm/src/next/jobs/run.d.ts.map +1 -0
- package/esm/src/next/jobs/run.js +563 -0
- package/esm/src/next/jobs/stream.d.ts +3 -0
- package/esm/src/next/jobs/stream.d.ts.map +1 -0
- package/esm/src/next/jobs/stream.js +25 -0
- package/esm/src/next/pwa/mod.d.ts +104 -0
- package/esm/src/next/pwa/mod.d.ts.map +1 -0
- package/esm/src/next/pwa/mod.js +169 -0
- package/esm/src/next/pwa/worker.d.ts +27 -0
- package/esm/src/next/pwa/worker.d.ts.map +1 -0
- package/esm/src/next/pwa/worker.js +27 -0
- package/package.json +293 -0
- package/script/_dnt.polyfills.d.ts +149 -0
- package/script/_dnt.polyfills.d.ts.map +1 -0
- package/script/_dnt.polyfills.js +166 -0
- package/script/_dnt.shims.d.ts +2 -0
- package/script/_dnt.shims.d.ts.map +1 -0
- package/script/_dnt.shims.js +60 -0
- package/script/bin/loom.d.ts +2 -0
- package/script/bin/loom.d.ts.map +1 -0
- package/script/bin/loom.js +17 -0
- package/script/mod.d.ts +9 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +24 -0
- package/script/package.json +3 -0
- package/script/src/apiKeys/authorize.d.ts +4 -0
- package/script/src/apiKeys/authorize.d.ts.map +1 -0
- package/script/src/apiKeys/authorize.js +187 -0
- package/script/src/apiKeys/country.d.ts +3 -0
- package/script/src/apiKeys/country.d.ts.map +1 -0
- package/script/src/apiKeys/country.js +10 -0
- package/script/src/apiKeys/credentials.d.ts +4 -0
- package/script/src/apiKeys/credentials.d.ts.map +1 -0
- package/script/src/apiKeys/credentials.js +58 -0
- package/script/src/apiKeys/fingerprint.d.ts +3 -0
- package/script/src/apiKeys/fingerprint.d.ts.map +1 -0
- package/script/src/apiKeys/fingerprint.js +8 -0
- package/script/src/apiKeys/mod.d.ts +9 -0
- package/script/src/apiKeys/mod.d.ts.map +1 -0
- package/script/src/apiKeys/mod.js +24 -0
- package/script/src/apiKeys/policy.d.ts +59 -0
- package/script/src/apiKeys/policy.d.ts.map +1 -0
- package/script/src/apiKeys/policy.js +92 -0
- package/script/src/apiKeys/retention.d.ts +55 -0
- package/script/src/apiKeys/retention.d.ts.map +1 -0
- package/script/src/apiKeys/retention.js +70 -0
- package/script/src/apiKeys/types.d.ts +175 -0
- package/script/src/apiKeys/types.d.ts.map +1 -0
- package/script/src/apiKeys/types.js +2 -0
- package/script/src/cli/externalSkills.d.ts +39 -0
- package/script/src/cli/externalSkills.d.ts.map +1 -0
- package/script/src/cli/externalSkills.js +181 -0
- package/script/src/cli/mod.d.ts +337 -0
- package/script/src/cli/mod.d.ts.map +1 -0
- package/script/src/cli/mod.js +9337 -0
- package/script/src/cli/projectSkills.d.ts +102 -0
- package/script/src/cli/projectSkills.d.ts.map +1 -0
- package/script/src/cli/projectSkills.js +606 -0
- package/script/src/files/client.d.ts +29 -0
- package/script/src/files/client.d.ts.map +1 -0
- package/script/src/files/client.js +45 -0
- package/script/src/files/errors.d.ts +37 -0
- package/script/src/files/errors.d.ts.map +1 -0
- package/script/src/files/errors.js +76 -0
- package/script/src/files/hash.d.ts +15 -0
- package/script/src/files/hash.d.ts.map +1 -0
- package/script/src/files/hash.js +89 -0
- package/script/src/files/memory.d.ts +29 -0
- package/script/src/files/memory.d.ts.map +1 -0
- package/script/src/files/memory.js +113 -0
- package/script/src/files/metadata.d.ts +10 -0
- package/script/src/files/metadata.d.ts.map +1 -0
- package/script/src/files/metadata.js +189 -0
- package/script/src/files/mod.d.ts +10 -0
- package/script/src/files/mod.d.ts.map +1 -0
- package/script/src/files/mod.js +25 -0
- package/script/src/files/s3.d.ts +29 -0
- package/script/src/files/s3.d.ts.map +1 -0
- package/script/src/files/s3.js +110 -0
- package/script/src/files/service.d.ts +27 -0
- package/script/src/files/service.d.ts.map +1 -0
- package/script/src/files/service.js +139 -0
- package/script/src/files/types.d.ts +134 -0
- package/script/src/files/types.d.ts.map +1 -0
- package/script/src/files/types.js +2 -0
- package/script/src/jobs/catalog.d.ts +32 -0
- package/script/src/jobs/catalog.d.ts.map +1 -0
- package/script/src/jobs/catalog.js +223 -0
- package/script/src/jobs/controller.d.ts +28 -0
- package/script/src/jobs/controller.d.ts.map +1 -0
- package/script/src/jobs/controller.js +100 -0
- package/script/src/jobs/direct.d.ts +36 -0
- package/script/src/jobs/direct.d.ts.map +1 -0
- package/script/src/jobs/direct.js +128 -0
- package/script/src/jobs/events.d.ts +15 -0
- package/script/src/jobs/events.d.ts.map +1 -0
- package/script/src/jobs/events.js +37 -0
- package/script/src/jobs/format.d.ts +16 -0
- package/script/src/jobs/format.d.ts.map +1 -0
- package/script/src/jobs/format.js +193 -0
- package/script/src/jobs/http.d.ts +22 -0
- package/script/src/jobs/http.d.ts.map +1 -0
- package/script/src/jobs/http.js +50 -0
- package/script/src/jobs/log.d.ts +2 -0
- package/script/src/jobs/log.d.ts.map +1 -0
- package/script/src/jobs/log.js +13 -0
- package/script/src/jobs/mod.d.ts +10 -0
- package/script/src/jobs/mod.d.ts.map +1 -0
- package/script/src/jobs/mod.js +25 -0
- package/script/src/jobs/run.d.ts +20 -0
- package/script/src/jobs/run.d.ts.map +1 -0
- package/script/src/jobs/run.js +61 -0
- package/script/src/jobs/types.d.ts +31 -0
- package/script/src/jobs/types.d.ts.map +1 -0
- package/script/src/jobs/types.js +2 -0
- package/script/src/mui/apiKeys.d.ts +65 -0
- package/script/src/mui/apiKeys.d.ts.map +1 -0
- package/script/src/mui/apiKeys.js +327 -0
- package/script/src/mui/apiKeysView.d.ts +48 -0
- package/script/src/mui/apiKeysView.d.ts.map +1 -0
- package/script/src/mui/apiKeysView.js +40 -0
- package/script/src/mui/confirm.d.ts +12 -0
- package/script/src/mui/confirm.d.ts.map +1 -0
- package/script/src/mui/confirm.js +85 -0
- package/script/src/mui/mod.d.ts +4 -0
- package/script/src/mui/mod.d.ts.map +1 -0
- package/script/src/mui/mod.js +19 -0
- package/script/src/next/apiKeys/mod.d.ts +64 -0
- package/script/src/next/apiKeys/mod.d.ts.map +1 -0
- package/script/src/next/apiKeys/mod.js +224 -0
- package/script/src/next/auth/config.d.ts +34 -0
- package/script/src/next/auth/config.d.ts.map +1 -0
- package/script/src/next/auth/config.js +142 -0
- package/script/src/next/auth/mod.d.ts +3 -0
- package/script/src/next/auth/mod.d.ts.map +1 -0
- package/script/src/next/auth/mod.js +18 -0
- package/script/src/next/auth/server.d.ts +28 -0
- package/script/src/next/auth/server.d.ts.map +1 -0
- package/script/src/next/auth/server.js +27 -0
- package/script/src/next/files/mod.d.ts +3 -0
- package/script/src/next/files/mod.d.ts.map +1 -0
- package/script/src/next/files/mod.js +18 -0
- package/script/src/next/files/route.d.ts +99 -0
- package/script/src/next/files/route.d.ts.map +1 -0
- package/script/src/next/files/route.js +353 -0
- package/script/src/next/jobs/list.d.ts +25 -0
- package/script/src/next/jobs/list.d.ts.map +1 -0
- package/script/src/next/jobs/list.js +48 -0
- package/script/src/next/jobs/mod.d.ts +6 -0
- package/script/src/next/jobs/mod.d.ts.map +1 -0
- package/script/src/next/jobs/mod.js +21 -0
- package/script/src/next/jobs/paths.d.ts +14 -0
- package/script/src/next/jobs/paths.d.ts.map +1 -0
- package/script/src/next/jobs/paths.js +47 -0
- package/script/src/next/jobs/route.d.ts +48 -0
- package/script/src/next/jobs/route.d.ts.map +1 -0
- package/script/src/next/jobs/route.js +105 -0
- package/script/src/next/jobs/run.d.ts +51 -0
- package/script/src/next/jobs/run.d.ts.map +1 -0
- package/script/src/next/jobs/run.js +570 -0
- package/script/src/next/jobs/stream.d.ts +3 -0
- package/script/src/next/jobs/stream.d.ts.map +1 -0
- package/script/src/next/jobs/stream.js +28 -0
- package/script/src/next/pwa/mod.d.ts +104 -0
- package/script/src/next/pwa/mod.d.ts.map +1 -0
- package/script/src/next/pwa/mod.js +192 -0
- package/script/src/next/pwa/worker.d.ts +27 -0
- package/script/src/next/pwa/worker.d.ts.map +1 -0
- package/script/src/next/pwa/worker.js +33 -0
- package/skills/loom/SKILL.md +200 -0
- package/skills/loom-api-keys/SKILL.md +123 -0
- package/skills/loom-auth/SKILL.md +70 -0
- package/skills/loom-db/SKILL.md +94 -0
- package/skills/loom-db/references/db-stack.md +39 -0
- package/skills/loom-files/SKILL.md +97 -0
- package/skills/loom-jobs/SKILL.md +148 -0
- package/skills/upgrade-deps/SKILL.md +165 -0
- package/skills/upgrade-deps/agents/openai.yaml +4 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
+
* but instead of using npm to install additional dependencies,
|
|
4
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
+
*
|
|
6
|
+
* Note that this code might be imported multiple times
|
|
7
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
+
*/
|
|
13
|
+
import { createRequire } from "node:module";
|
|
14
|
+
import { type URL } from "node:url";
|
|
15
|
+
declare global {
|
|
16
|
+
interface ImportMeta {
|
|
17
|
+
/** A string representation of the fully qualified module URL. When the
|
|
18
|
+
* module is loaded locally, the value will be a file URL (e.g.
|
|
19
|
+
* `file:///path/module.ts`).
|
|
20
|
+
*
|
|
21
|
+
* You can also parse the string as a URL to determine more information about
|
|
22
|
+
* how the current module was loaded. For example to determine if a module was
|
|
23
|
+
* local or not:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const url = new URL(import.meta.url);
|
|
27
|
+
* if (url.protocol === "file:") {
|
|
28
|
+
* console.log("this module was loaded locally");
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
url: string;
|
|
33
|
+
/**
|
|
34
|
+
* A function that returns resolved specifier as if it would be imported
|
|
35
|
+
* using `import(specifier)`.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* console.log(import.meta.resolve("./foo.js"));
|
|
39
|
+
* // file:///dev/foo.js
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param specifier The module specifier to resolve relative to `parent`.
|
|
43
|
+
* @param parent The absolute parent module URL to resolve from.
|
|
44
|
+
* @returns The absolute (`file:`) URL string for the resolved module.
|
|
45
|
+
*/
|
|
46
|
+
resolve(specifier: string, parent?: string | URL | undefined): string;
|
|
47
|
+
/** A flag that indicates if the current module is the main module that was
|
|
48
|
+
* called when starting the program under Deno.
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* if (import.meta.main) {
|
|
52
|
+
* // this was loaded as the main module, maybe do some bootstrapping
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
main: boolean;
|
|
57
|
+
/** The absolute path of the current module.
|
|
58
|
+
*
|
|
59
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
60
|
+
*
|
|
61
|
+
* Example:
|
|
62
|
+
* ```
|
|
63
|
+
* // Unix
|
|
64
|
+
* console.log(import.meta.filename); // /home/alice/my_module.ts
|
|
65
|
+
*
|
|
66
|
+
* // Windows
|
|
67
|
+
* console.log(import.meta.filename); // C:\alice\my_module.ts
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
filename: string;
|
|
71
|
+
/** The absolute path of the directory containing the current module.
|
|
72
|
+
*
|
|
73
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
74
|
+
*
|
|
75
|
+
* * Example:
|
|
76
|
+
* ```
|
|
77
|
+
* // Unix
|
|
78
|
+
* console.log(import.meta.dirname); // /home/alice
|
|
79
|
+
*
|
|
80
|
+
* // Windows
|
|
81
|
+
* console.log(import.meta.dirname); // C:\alice
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
dirname: string;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
type NodeRequest = ReturnType<typeof createRequire>;
|
|
88
|
+
type NodeModule = NonNullable<NodeRequest["main"]>;
|
|
89
|
+
interface ImportMetaPonyfillCommonjs {
|
|
90
|
+
(require: NodeRequest, module: NodeModule): ImportMeta;
|
|
91
|
+
}
|
|
92
|
+
interface ImportMetaPonyfillEsmodule {
|
|
93
|
+
(importMeta: ImportMeta): ImportMeta;
|
|
94
|
+
}
|
|
95
|
+
interface ImportMetaPonyfill extends ImportMetaPonyfillCommonjs, ImportMetaPonyfillEsmodule {
|
|
96
|
+
}
|
|
97
|
+
export declare let import_meta_ponyfill_commonjs: ImportMetaPonyfillCommonjs;
|
|
98
|
+
export declare let import_meta_ponyfill_esmodule: ImportMetaPonyfillEsmodule;
|
|
99
|
+
export declare let import_meta_ponyfill: ImportMetaPonyfill;
|
|
100
|
+
declare global {
|
|
101
|
+
interface Array<T> {
|
|
102
|
+
/**
|
|
103
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
104
|
+
* otherwise.
|
|
105
|
+
* @param predicate find calls predicate once for each element of the array, in ascending
|
|
106
|
+
* order, until it finds one where predicate returns true. If such an element is found, find
|
|
107
|
+
* immediately returns that element value. Otherwise, find returns undefined.
|
|
108
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
109
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
110
|
+
*/
|
|
111
|
+
findLast<S extends T>(predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined;
|
|
112
|
+
findLast(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
115
|
+
* otherwise.
|
|
116
|
+
* @param predicate find calls predicate once for each element of the array, in ascending
|
|
117
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
118
|
+
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
|
119
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
120
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
121
|
+
*/
|
|
122
|
+
findLastIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;
|
|
123
|
+
}
|
|
124
|
+
interface Uint8Array {
|
|
125
|
+
/**
|
|
126
|
+
* Returns the value of the last element in the array where predicate is true, and undefined
|
|
127
|
+
* otherwise.
|
|
128
|
+
* @param predicate findLast calls predicate once for each element of the array, in descending
|
|
129
|
+
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
|
130
|
+
* immediately returns that element value. Otherwise, findLast returns undefined.
|
|
131
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
132
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
133
|
+
*/
|
|
134
|
+
findLast<S extends number>(predicate: (value: number, index: number, array: Uint8Array) => value is S, thisArg?: any): S | undefined;
|
|
135
|
+
findLast(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): number | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* Returns the index of the last element in the array where predicate is true, and -1
|
|
138
|
+
* otherwise.
|
|
139
|
+
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
|
140
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
141
|
+
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
|
142
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
143
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
144
|
+
*/
|
|
145
|
+
findLastIndex(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): number;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
export {};
|
|
149
|
+
//# sourceMappingURL=_dnt.polyfills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.import_meta_ponyfill = exports.import_meta_ponyfill_esmodule = exports.import_meta_ponyfill_commonjs = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
6
|
+
* but instead of using npm to install additional dependencies,
|
|
7
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
8
|
+
*
|
|
9
|
+
* Note that this code might be imported multiple times
|
|
10
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
11
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
12
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
13
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
14
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
15
|
+
*/
|
|
16
|
+
//@ts-ignore
|
|
17
|
+
const node_module_1 = require("node:module");
|
|
18
|
+
//@ts-ignore
|
|
19
|
+
const node_url_1 = require("node:url");
|
|
20
|
+
//@ts-ignore
|
|
21
|
+
const node_path_1 = require("node:path");
|
|
22
|
+
const defineGlobalPonyfill = (symbolFor, fn) => {
|
|
23
|
+
if (!Reflect.has(globalThis, Symbol.for(symbolFor))) {
|
|
24
|
+
Object.defineProperty(globalThis, Symbol.for(symbolFor), {
|
|
25
|
+
configurable: true,
|
|
26
|
+
get() {
|
|
27
|
+
return fn;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.import_meta_ponyfill_commonjs = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-commonjs")) ??
|
|
33
|
+
(() => {
|
|
34
|
+
const moduleImportMetaWM = new WeakMap();
|
|
35
|
+
return (require, module) => {
|
|
36
|
+
let importMetaCache = moduleImportMetaWM.get(module);
|
|
37
|
+
if (importMetaCache == null) {
|
|
38
|
+
const importMeta = Object.assign(Object.create(null), {
|
|
39
|
+
url: (0, node_url_1.pathToFileURL)(module.filename).href,
|
|
40
|
+
main: require.main == module,
|
|
41
|
+
resolve: (specifier, parentURL = importMeta.url) => {
|
|
42
|
+
return (0, node_url_1.pathToFileURL)((importMeta.url === parentURL
|
|
43
|
+
? require
|
|
44
|
+
: (0, node_module_1.createRequire)(parentURL))
|
|
45
|
+
.resolve(specifier)).href;
|
|
46
|
+
},
|
|
47
|
+
filename: module.filename,
|
|
48
|
+
dirname: module.path,
|
|
49
|
+
});
|
|
50
|
+
moduleImportMetaWM.set(module, importMeta);
|
|
51
|
+
importMetaCache = importMeta;
|
|
52
|
+
}
|
|
53
|
+
return importMetaCache;
|
|
54
|
+
};
|
|
55
|
+
})());
|
|
56
|
+
defineGlobalPonyfill("import-meta-ponyfill-commonjs", exports.import_meta_ponyfill_commonjs);
|
|
57
|
+
exports.import_meta_ponyfill_esmodule = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-esmodule")) ??
|
|
58
|
+
((importMeta) => {
|
|
59
|
+
const resolveFunStr = String(importMeta.resolve);
|
|
60
|
+
const shimWs = new WeakSet();
|
|
61
|
+
//@ts-ignore
|
|
62
|
+
const mainUrl = ("file:///" + process.argv[1].replace(/\\/g, "/"))
|
|
63
|
+
.replace(/\/{3,}/, "///");
|
|
64
|
+
const commonShim = (importMeta) => {
|
|
65
|
+
if (typeof importMeta.main !== "boolean") {
|
|
66
|
+
importMeta.main = importMeta.url === mainUrl;
|
|
67
|
+
}
|
|
68
|
+
if (typeof importMeta.filename !== "string") {
|
|
69
|
+
importMeta.filename = (0, node_url_1.fileURLToPath)(importMeta.url);
|
|
70
|
+
importMeta.dirname = (0, node_path_1.dirname)(importMeta.filename);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
if (
|
|
74
|
+
// v16.2.0+, v14.18.0+: Add support for WHATWG URL object to parentURL parameter.
|
|
75
|
+
resolveFunStr === "undefined" ||
|
|
76
|
+
// v20.0.0+, v18.19.0+"" This API now returns a string synchronously instead of a Promise.
|
|
77
|
+
resolveFunStr.startsWith("async")
|
|
78
|
+
// enable by --experimental-import-meta-resolve flag
|
|
79
|
+
) {
|
|
80
|
+
exports.import_meta_ponyfill_esmodule = (importMeta) => {
|
|
81
|
+
if (!shimWs.has(importMeta)) {
|
|
82
|
+
shimWs.add(importMeta);
|
|
83
|
+
const importMetaUrlRequire = {
|
|
84
|
+
url: importMeta.url,
|
|
85
|
+
require: (0, node_module_1.createRequire)(importMeta.url),
|
|
86
|
+
};
|
|
87
|
+
importMeta.resolve = function resolve(specifier, parentURL = importMeta.url) {
|
|
88
|
+
return (0, node_url_1.pathToFileURL)((importMetaUrlRequire.url === parentURL
|
|
89
|
+
? importMetaUrlRequire.require
|
|
90
|
+
: (0, node_module_1.createRequire)(parentURL)).resolve(specifier)).href;
|
|
91
|
+
};
|
|
92
|
+
commonShim(importMeta);
|
|
93
|
+
}
|
|
94
|
+
return importMeta;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
/// native support
|
|
99
|
+
exports.import_meta_ponyfill_esmodule = (importMeta) => {
|
|
100
|
+
if (!shimWs.has(importMeta)) {
|
|
101
|
+
shimWs.add(importMeta);
|
|
102
|
+
commonShim(importMeta);
|
|
103
|
+
}
|
|
104
|
+
return importMeta;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return (0, exports.import_meta_ponyfill_esmodule)(importMeta);
|
|
108
|
+
}));
|
|
109
|
+
defineGlobalPonyfill("import-meta-ponyfill-esmodule", exports.import_meta_ponyfill_esmodule);
|
|
110
|
+
exports.import_meta_ponyfill = ((...args) => {
|
|
111
|
+
const _MODULE = (() => {
|
|
112
|
+
if (typeof require === "function" && typeof module === "object") {
|
|
113
|
+
return "commonjs";
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
// eval("typeof import.meta");
|
|
117
|
+
return "esmodule";
|
|
118
|
+
}
|
|
119
|
+
})();
|
|
120
|
+
if (_MODULE === "commonjs") {
|
|
121
|
+
//@ts-ignore
|
|
122
|
+
exports.import_meta_ponyfill = (r, m) => (0, exports.import_meta_ponyfill_commonjs)(r, m);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
//@ts-ignore
|
|
126
|
+
exports.import_meta_ponyfill = (im) => (0, exports.import_meta_ponyfill_esmodule)(im);
|
|
127
|
+
}
|
|
128
|
+
//@ts-ignore
|
|
129
|
+
return (0, exports.import_meta_ponyfill)(...args);
|
|
130
|
+
});
|
|
131
|
+
function findLastIndex(self, callbackfn, that) {
|
|
132
|
+
const boundFunc = that === undefined ? callbackfn : callbackfn.bind(that);
|
|
133
|
+
let index = self.length - 1;
|
|
134
|
+
while (index >= 0) {
|
|
135
|
+
const result = boundFunc(self[index], index, self);
|
|
136
|
+
if (result) {
|
|
137
|
+
return index;
|
|
138
|
+
}
|
|
139
|
+
index--;
|
|
140
|
+
}
|
|
141
|
+
return -1;
|
|
142
|
+
}
|
|
143
|
+
function findLast(self, callbackfn, that) {
|
|
144
|
+
const index = self.findLastIndex(callbackfn, that);
|
|
145
|
+
return index === -1 ? undefined : self[index];
|
|
146
|
+
}
|
|
147
|
+
if (!Array.prototype.findLastIndex) {
|
|
148
|
+
Array.prototype.findLastIndex = function (callbackfn, that) {
|
|
149
|
+
return findLastIndex(this, callbackfn, that);
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
if (!Array.prototype.findLast) {
|
|
153
|
+
Array.prototype.findLast = function (callbackfn, that) {
|
|
154
|
+
return findLast(this, callbackfn, that);
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
if (!Uint8Array.prototype.findLastIndex) {
|
|
158
|
+
Uint8Array.prototype.findLastIndex = function (callbackfn, that) {
|
|
159
|
+
return findLastIndex(this, callbackfn, that);
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (!Uint8Array.prototype.findLast) {
|
|
163
|
+
Uint8Array.prototype.findLast = function (callbackfn, that) {
|
|
164
|
+
return findLast(this, callbackfn, that);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gCAA2C,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dntGlobalThis = void 0;
|
|
4
|
+
const dntGlobals = {};
|
|
5
|
+
exports.dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
6
|
+
function createMergeProxy(baseObj, extObj) {
|
|
7
|
+
return new Proxy(baseObj, {
|
|
8
|
+
get(_target, prop, _receiver) {
|
|
9
|
+
if (prop in extObj) {
|
|
10
|
+
return extObj[prop];
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
return baseObj[prop];
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
set(_target, prop, value) {
|
|
17
|
+
if (prop in extObj) {
|
|
18
|
+
delete extObj[prop];
|
|
19
|
+
}
|
|
20
|
+
baseObj[prop] = value;
|
|
21
|
+
return true;
|
|
22
|
+
},
|
|
23
|
+
deleteProperty(_target, prop) {
|
|
24
|
+
let success = false;
|
|
25
|
+
if (prop in extObj) {
|
|
26
|
+
delete extObj[prop];
|
|
27
|
+
success = true;
|
|
28
|
+
}
|
|
29
|
+
if (prop in baseObj) {
|
|
30
|
+
delete baseObj[prop];
|
|
31
|
+
success = true;
|
|
32
|
+
}
|
|
33
|
+
return success;
|
|
34
|
+
},
|
|
35
|
+
ownKeys(_target) {
|
|
36
|
+
const baseKeys = Reflect.ownKeys(baseObj);
|
|
37
|
+
const extKeys = Reflect.ownKeys(extObj);
|
|
38
|
+
const extKeysSet = new Set(extKeys);
|
|
39
|
+
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
40
|
+
},
|
|
41
|
+
defineProperty(_target, prop, desc) {
|
|
42
|
+
if (prop in extObj) {
|
|
43
|
+
delete extObj[prop];
|
|
44
|
+
}
|
|
45
|
+
Reflect.defineProperty(baseObj, prop, desc);
|
|
46
|
+
return true;
|
|
47
|
+
},
|
|
48
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
49
|
+
if (prop in extObj) {
|
|
50
|
+
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
has(_target, prop) {
|
|
57
|
+
return prop in extObj || prop in baseObj;
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loom.d.ts","sourceRoot":"","sources":["../../src/bin/loom.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
require("../_dnt.polyfills.js");
|
|
8
|
+
const node_process_1 = __importDefault(require("node:process"));
|
|
9
|
+
const mod_js_1 = require("../src/cli/mod.js");
|
|
10
|
+
(0, mod_js_1.runCli)(node_process_1.default.argv.slice(2))
|
|
11
|
+
.then((code) => {
|
|
12
|
+
node_process_1.default.exitCode = code;
|
|
13
|
+
})
|
|
14
|
+
.catch((error) => {
|
|
15
|
+
console.error(error);
|
|
16
|
+
node_process_1.default.exitCode = 1;
|
|
17
|
+
});
|
package/script/mod.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "./_dnt.polyfills.js";
|
|
2
|
+
export * from "./src/apiKeys/mod.js";
|
|
3
|
+
export * from "./src/files/mod.js";
|
|
4
|
+
export * from "./src/jobs/mod.js";
|
|
5
|
+
export * from "./src/next/auth/mod.js";
|
|
6
|
+
export * from "./src/next/apiKeys/mod.js";
|
|
7
|
+
export * from "./src/next/files/mod.js";
|
|
8
|
+
export * from "./src/next/jobs/mod.js";
|
|
9
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC"}
|
package/script/mod.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
require("./_dnt.polyfills.js");
|
|
18
|
+
__exportStar(require("./src/apiKeys/mod.js"), exports);
|
|
19
|
+
__exportStar(require("./src/files/mod.js"), exports);
|
|
20
|
+
__exportStar(require("./src/jobs/mod.js"), exports);
|
|
21
|
+
__exportStar(require("./src/next/auth/mod.js"), exports);
|
|
22
|
+
__exportStar(require("./src/next/apiKeys/mod.js"), exports);
|
|
23
|
+
__exportStar(require("./src/next/files/mod.js"), exports);
|
|
24
|
+
__exportStar(require("./src/next/jobs/mod.js"), exports);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ApiKeyAuthorizationResult, AuthorizeApiKeyOptions } from "./types.js";
|
|
2
|
+
/** Authorizes one credential and durably records access before it is granted. */
|
|
3
|
+
export declare function authorizeApiKey(options: AuthorizeApiKeyOptions): Promise<ApiKeyAuthorizationResult>;
|
|
4
|
+
//# sourceMappingURL=authorize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../../src/src/apiKeys/authorize.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,yBAAyB,EAGzB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AA2DpB,iFAAiF;AACjF,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,yBAAyB,CAAC,CAgJpC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.authorizeApiKey = authorizeApiKey;
|
|
4
|
+
const credentials_js_1 = require("./credentials.js");
|
|
5
|
+
const country_js_1 = require("./country.js");
|
|
6
|
+
const fingerprint_js_1 = require("./fingerprint.js");
|
|
7
|
+
function statusForExtraction(kind) {
|
|
8
|
+
return kind === "missing" ? 401 : 400;
|
|
9
|
+
}
|
|
10
|
+
function codeForExtraction(kind) {
|
|
11
|
+
if (kind === "ambiguous")
|
|
12
|
+
return "ambiguous_credentials";
|
|
13
|
+
if (kind === "malformed")
|
|
14
|
+
return "credential_malformed";
|
|
15
|
+
return "credential_missing";
|
|
16
|
+
}
|
|
17
|
+
function baseAuditEvent(options) {
|
|
18
|
+
const descriptor = options.descriptor;
|
|
19
|
+
return {
|
|
20
|
+
actionName: descriptor.actionName,
|
|
21
|
+
countryCode: (0, country_js_1.normalizeApiKeyCountryCode)(options.request?.countryCode),
|
|
22
|
+
functionName: descriptor.functionName,
|
|
23
|
+
ipAddress: options.request?.ipAddress,
|
|
24
|
+
metadata: descriptor.metadata,
|
|
25
|
+
method: options.request?.method,
|
|
26
|
+
operation: descriptor.operation,
|
|
27
|
+
pageName: descriptor.pageName,
|
|
28
|
+
requestId: options.request?.requestId,
|
|
29
|
+
routeTemplate: options.request?.routeTemplate,
|
|
30
|
+
scopeAction: descriptor.permission.action,
|
|
31
|
+
scopeResource: descriptor.permission.resource,
|
|
32
|
+
userAgent: options.request?.userAgent,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async function recordDenied(options, event) {
|
|
36
|
+
try {
|
|
37
|
+
return await options.audit.append(event);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// A persistence outage cannot make an already-denied request less denied.
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function principalAuditFields(principal) {
|
|
45
|
+
return {
|
|
46
|
+
keyId: principal.keyId,
|
|
47
|
+
keyNameSnapshot: principal.keyName,
|
|
48
|
+
keyStartSnapshot: principal.keyStart,
|
|
49
|
+
ownerId: principal.ownerId,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** Authorizes one credential and durably records access before it is granted. */
|
|
53
|
+
async function authorizeApiKey(options) {
|
|
54
|
+
const extracted = (0, credentials_js_1.extractApiKeyCredential)(options.source, options.credentialOptions);
|
|
55
|
+
const auditBase = baseAuditEvent(options);
|
|
56
|
+
if (extracted.kind !== "present") {
|
|
57
|
+
const code = codeForExtraction(extracted.kind);
|
|
58
|
+
const status = statusForExtraction(extracted.kind);
|
|
59
|
+
const recorded = await recordDenied(options, {
|
|
60
|
+
...auditBase,
|
|
61
|
+
authorizationOutcome: "denied",
|
|
62
|
+
eventType: "authorization",
|
|
63
|
+
httpStatus: status,
|
|
64
|
+
reasonCode: code,
|
|
65
|
+
transport: extracted.kind === "missing"
|
|
66
|
+
? undefined
|
|
67
|
+
: extracted.kind === "ambiguous"
|
|
68
|
+
? undefined
|
|
69
|
+
: extracted.transport,
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
authorizationEventId: recorded?.id,
|
|
73
|
+
code,
|
|
74
|
+
ok: false,
|
|
75
|
+
status,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const credentialFingerprint = await (0, fingerprint_js_1.fingerprintApiKeyCredential)(extracted.credential);
|
|
79
|
+
let verification;
|
|
80
|
+
try {
|
|
81
|
+
verification = await options.verifier.verify({
|
|
82
|
+
credential: extracted.credential,
|
|
83
|
+
permission: options.descriptor.permission,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
const recorded = await recordDenied(options, {
|
|
88
|
+
...auditBase,
|
|
89
|
+
authorizationOutcome: "error",
|
|
90
|
+
credentialFingerprint,
|
|
91
|
+
eventType: "authorization",
|
|
92
|
+
httpStatus: 500,
|
|
93
|
+
reasonCode: "verification_error",
|
|
94
|
+
transport: extracted.transport,
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
authorizationEventId: recorded?.id,
|
|
98
|
+
code: "verification_error",
|
|
99
|
+
ok: false,
|
|
100
|
+
status: 500,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (!verification.ok) {
|
|
104
|
+
const status = verification.status ??
|
|
105
|
+
(verification.code === "rate_limited"
|
|
106
|
+
? 429
|
|
107
|
+
: verification.code === "insufficient_permission"
|
|
108
|
+
? 403
|
|
109
|
+
: 401);
|
|
110
|
+
const recorded = await recordDenied(options, {
|
|
111
|
+
...auditBase,
|
|
112
|
+
authorizationOutcome: "denied",
|
|
113
|
+
credentialFingerprint,
|
|
114
|
+
eventType: "authorization",
|
|
115
|
+
httpStatus: status,
|
|
116
|
+
reasonCode: verification.code,
|
|
117
|
+
transport: extracted.transport,
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
authorizationEventId: recorded?.id,
|
|
121
|
+
code: verification.code,
|
|
122
|
+
ok: false,
|
|
123
|
+
status,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
let policy;
|
|
127
|
+
try {
|
|
128
|
+
policy = await options.policy.authorize(verification.principal, options.descriptor);
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
const recorded = await recordDenied(options, {
|
|
132
|
+
...auditBase,
|
|
133
|
+
...principalAuditFields(verification.principal),
|
|
134
|
+
authorizationOutcome: "error",
|
|
135
|
+
credentialFingerprint,
|
|
136
|
+
eventType: "authorization",
|
|
137
|
+
httpStatus: 500,
|
|
138
|
+
reasonCode: "policy_error",
|
|
139
|
+
transport: extracted.transport,
|
|
140
|
+
});
|
|
141
|
+
return {
|
|
142
|
+
authorizationEventId: recorded?.id,
|
|
143
|
+
code: "policy_error",
|
|
144
|
+
ok: false,
|
|
145
|
+
status: 500,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (!policy.ok) {
|
|
149
|
+
const recorded = await recordDenied(options, {
|
|
150
|
+
...auditBase,
|
|
151
|
+
...principalAuditFields(verification.principal),
|
|
152
|
+
authorizationOutcome: "denied",
|
|
153
|
+
credentialFingerprint,
|
|
154
|
+
eventType: "authorization",
|
|
155
|
+
httpStatus: policy.status ?? 403,
|
|
156
|
+
reasonCode: policy.code ?? "forbidden",
|
|
157
|
+
transport: extracted.transport,
|
|
158
|
+
});
|
|
159
|
+
return {
|
|
160
|
+
authorizationEventId: recorded?.id,
|
|
161
|
+
code: policy.code ?? "forbidden",
|
|
162
|
+
ok: false,
|
|
163
|
+
status: policy.status ?? 403,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
try {
|
|
167
|
+
const recorded = await options.audit.append({
|
|
168
|
+
...auditBase,
|
|
169
|
+
...principalAuditFields(verification.principal),
|
|
170
|
+
authorizationOutcome: "allowed",
|
|
171
|
+
credentialFingerprint,
|
|
172
|
+
eventType: "authorization",
|
|
173
|
+
httpStatus: 200,
|
|
174
|
+
transport: extracted.transport,
|
|
175
|
+
});
|
|
176
|
+
return {
|
|
177
|
+
authorizationEventId: recorded.id,
|
|
178
|
+
credentialFingerprint,
|
|
179
|
+
ok: true,
|
|
180
|
+
principal: verification.principal,
|
|
181
|
+
transport: extracted.transport,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return { code: "audit_unavailable", ok: false, status: 503 };
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country.d.ts","sourceRoot":"","sources":["../../../src/src/apiKeys/country.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,wBAAgB,0BAA0B,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,sBAK/D"}
|