@cipherstash/stack 0.13.0 → 0.15.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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/{chunk-46PDK2Z6.js → chunk-MD6742R6.js} +1 -1
- package/dist/{chunk-46PDK2Z6.js.map → chunk-MD6742R6.js.map} +1 -1
- package/dist/{chunk-O4MBO4DJ.js → chunk-YPAPL3IC.js} +2 -2
- package/dist/{client-bW-5wG9Y.d.cts → client-DQyqn0oT.d.cts} +1 -1
- package/dist/{client-CZLBiToT.d.ts → client-Dv60lAyy.d.ts} +1 -1
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/drizzle/index.cjs +4 -2
- package/dist/drizzle/index.cjs.map +1 -1
- package/dist/drizzle/index.d.cts +2 -2
- package/dist/drizzle/index.d.ts +2 -2
- package/dist/drizzle/index.js +5 -3
- package/dist/drizzle/index.js.map +1 -1
- package/dist/dynamodb/index.d.cts +2 -2
- package/dist/dynamodb/index.d.ts +2 -2
- package/dist/encryption/index.cjs.map +1 -1
- package/dist/encryption/index.d.cts +2 -2
- package/dist/encryption/index.d.ts +2 -2
- package/dist/encryption/index.js +2 -2
- package/dist/identity/index.js +63 -3
- package/dist/identity/index.js.map +1 -1
- package/dist/index.cjs +6 -365
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +2 -7
- package/dist/schema/index.d.cts +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/supabase/index.d.cts +2 -2
- package/dist/supabase/index.d.ts +2 -2
- package/dist/{types-public-WADaA-TW.d.ts → types-public-DX3mGqoi.d.cts} +3 -3
- package/dist/{types-public-WADaA-TW.d.cts → types-public-DX3mGqoi.d.ts} +3 -3
- package/dist/types-public.cjs.map +1 -1
- package/dist/types-public.d.cts +1 -1
- package/dist/types-public.d.ts +1 -1
- package/dist/types-public.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-EHDOOLWU.js +0 -357
- package/dist/chunk-EHDOOLWU.js.map +0 -1
- package/dist/chunk-GXGEW6T4.js +0 -68
- package/dist/chunk-GXGEW6T4.js.map +0 -1
- package/dist/secrets/index.cjs +0 -3143
- package/dist/secrets/index.cjs.map +0 -1
- package/dist/secrets/index.d.cts +0 -225
- package/dist/secrets/index.d.ts +0 -225
- package/dist/secrets/index.js +0 -14
- package/dist/secrets/index.js.map +0 -1
- /package/dist/{chunk-O4MBO4DJ.js.map → chunk-YPAPL3IC.js.map} +0 -0
package/dist/chunk-GXGEW6T4.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// src/utils/config/index.ts
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
function getWorkspaceCrn(tomlString) {
|
|
5
|
-
let currentSection = "";
|
|
6
|
-
let workspaceCrn;
|
|
7
|
-
const lines = tomlString.split(/\r?\n/);
|
|
8
|
-
for (const line of lines) {
|
|
9
|
-
const trimmedLine = line.trim();
|
|
10
|
-
if (!trimmedLine || trimmedLine.startsWith("#")) {
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
const sectionMatch = trimmedLine.match(/^\[([^\]]+)\]$/);
|
|
14
|
-
if (sectionMatch) {
|
|
15
|
-
currentSection = sectionMatch[1];
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
const kvMatch = trimmedLine.match(/^(\w+)\s*=\s*"([^"]+)"$/);
|
|
19
|
-
if (kvMatch) {
|
|
20
|
-
const [_, key, value] = kvMatch;
|
|
21
|
-
if (currentSection === "auth" && key === "workspace_crn") {
|
|
22
|
-
workspaceCrn = value;
|
|
23
|
-
break;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return workspaceCrn;
|
|
28
|
-
}
|
|
29
|
-
function extractWorkspaceIdFromCrn(crn) {
|
|
30
|
-
const match = crn.match(/crn:[^:]+:([^:]+)$/);
|
|
31
|
-
if (!match) {
|
|
32
|
-
throw new Error("Invalid CRN format");
|
|
33
|
-
}
|
|
34
|
-
return match[1];
|
|
35
|
-
}
|
|
36
|
-
function loadWorkSpaceId(suppliedCrn) {
|
|
37
|
-
const configPath = path.join(process.cwd(), "cipherstash.toml");
|
|
38
|
-
if (suppliedCrn) {
|
|
39
|
-
return extractWorkspaceIdFromCrn(suppliedCrn);
|
|
40
|
-
}
|
|
41
|
-
if (!fs.existsSync(configPath) && !process.env.CS_WORKSPACE_CRN) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
"You have not defined a workspace CRN in your config file, or the CS_WORKSPACE_CRN environment variable."
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
if (process.env.CS_WORKSPACE_CRN) {
|
|
47
|
-
return extractWorkspaceIdFromCrn(process.env.CS_WORKSPACE_CRN);
|
|
48
|
-
}
|
|
49
|
-
if (!fs.existsSync(configPath)) {
|
|
50
|
-
throw new Error(
|
|
51
|
-
"You have not defined a workspace CRN in your config file, or the CS_WORKSPACE_CRN environment variable."
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
const tomlString = fs.readFileSync(configPath, "utf8");
|
|
55
|
-
const workspaceCrn = getWorkspaceCrn(tomlString);
|
|
56
|
-
if (!workspaceCrn) {
|
|
57
|
-
throw new Error(
|
|
58
|
-
"You have not defined a workspace CRN in your config file, or the CS_WORKSPACE_CRN environment variable."
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
return extractWorkspaceIdFromCrn(workspaceCrn);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export {
|
|
65
|
-
extractWorkspaceIdFromCrn,
|
|
66
|
-
loadWorkSpaceId
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=chunk-GXGEW6T4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/config/index.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * A lightweight function that parses a TOML-like string\n * and returns the `workspace_crn` value found under `[auth]`.\n *\n * @param tomlString The contents of the TOML file as a string.\n * @returns The workspace_crn if found, otherwise undefined.\n */\nfunction getWorkspaceCrn(tomlString: string): string | undefined {\n let currentSection = ''\n let workspaceCrn: string | undefined\n\n const lines = tomlString.split(/\\r?\\n/)\n\n for (const line of lines) {\n const trimmedLine = line.trim()\n\n if (!trimmedLine || trimmedLine.startsWith('#')) {\n continue\n }\n\n const sectionMatch = trimmedLine.match(/^\\[([^\\]]+)\\]$/)\n if (sectionMatch) {\n currentSection = sectionMatch[1]\n continue\n }\n\n const kvMatch = trimmedLine.match(/^(\\w+)\\s*=\\s*\"([^\"]+)\"$/)\n if (kvMatch) {\n const [_, key, value] = kvMatch\n\n if (currentSection === 'auth' && key === 'workspace_crn') {\n workspaceCrn = value\n break\n }\n }\n }\n\n return workspaceCrn\n}\n\n/**\n * Extracts the workspace ID from a CRN string.\n * CRN format: crn:region.aws:ID\n *\n * @param crn The CRN string to extract from\n * @returns The workspace ID portion of the CRN\n */\nexport function extractWorkspaceIdFromCrn(crn: string): string {\n const match = crn.match(/crn:[^:]+:([^:]+)$/)\n if (!match) {\n throw new Error('Invalid CRN format')\n }\n return match[1]\n}\n\nexport function loadWorkSpaceId(suppliedCrn?: string): string {\n const configPath = path.join(process.cwd(), 'cipherstash.toml')\n\n if (suppliedCrn) {\n return extractWorkspaceIdFromCrn(suppliedCrn)\n }\n\n if (!fs.existsSync(configPath) && !process.env.CS_WORKSPACE_CRN) {\n throw new Error(\n 'You have not defined a workspace CRN in your config file, or the CS_WORKSPACE_CRN environment variable.',\n )\n }\n\n // Environment variables take precedence over config files\n if (process.env.CS_WORKSPACE_CRN) {\n return extractWorkspaceIdFromCrn(process.env.CS_WORKSPACE_CRN)\n }\n\n if (!fs.existsSync(configPath)) {\n throw new Error(\n 'You have not defined a workspace CRN in your config file, or the CS_WORKSPACE_CRN environment variable.',\n )\n }\n\n const tomlString = fs.readFileSync(configPath, 'utf8')\n const workspaceCrn = getWorkspaceCrn(tomlString)\n\n if (!workspaceCrn) {\n throw new Error(\n 'You have not defined a workspace CRN in your config file, or the CS_WORKSPACE_CRN environment variable.',\n )\n }\n\n return extractWorkspaceIdFromCrn(workspaceCrn)\n}\n"],"mappings":";AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AASjB,SAAS,gBAAgB,YAAwC;AAC/D,MAAI,iBAAiB;AACrB,MAAI;AAEJ,QAAM,QAAQ,WAAW,MAAM,OAAO;AAEtC,aAAW,QAAQ,OAAO;AACxB,UAAM,cAAc,KAAK,KAAK;AAE9B,QAAI,CAAC,eAAe,YAAY,WAAW,GAAG,GAAG;AAC/C;AAAA,IACF;AAEA,UAAM,eAAe,YAAY,MAAM,gBAAgB;AACvD,QAAI,cAAc;AAChB,uBAAiB,aAAa,CAAC;AAC/B;AAAA,IACF;AAEA,UAAM,UAAU,YAAY,MAAM,yBAAyB;AAC3D,QAAI,SAAS;AACX,YAAM,CAAC,GAAG,KAAK,KAAK,IAAI;AAExB,UAAI,mBAAmB,UAAU,QAAQ,iBAAiB;AACxD,uBAAe;AACf;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AASO,SAAS,0BAA0B,KAAqB;AAC7D,QAAM,QAAQ,IAAI,MAAM,oBAAoB;AAC5C,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,oBAAoB;AAAA,EACtC;AACA,SAAO,MAAM,CAAC;AAChB;AAEO,SAAS,gBAAgB,aAA8B;AAC5D,QAAM,aAAa,KAAK,KAAK,QAAQ,IAAI,GAAG,kBAAkB;AAE9D,MAAI,aAAa;AACf,WAAO,0BAA0B,WAAW;AAAA,EAC9C;AAEA,MAAI,CAAC,GAAG,WAAW,UAAU,KAAK,CAAC,QAAQ,IAAI,kBAAkB;AAC/D,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAGA,MAAI,QAAQ,IAAI,kBAAkB;AAChC,WAAO,0BAA0B,QAAQ,IAAI,gBAAgB;AAAA,EAC/D;AAEA,MAAI,CAAC,GAAG,WAAW,UAAU,GAAG;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,aAAa,GAAG,aAAa,YAAY,MAAM;AACrD,QAAM,eAAe,gBAAgB,UAAU;AAE/C,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,0BAA0B,YAAY;AAC/C;","names":[]}
|