@shipfox/api-secrets 7.1.0 → 9.0.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.
Files changed (34) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +44 -0
  3. package/dist/core/identifier-policy.d.ts +4 -0
  4. package/dist/core/identifier-policy.d.ts.map +1 -0
  5. package/dist/core/identifier-policy.js +12 -0
  6. package/dist/core/identifier-policy.js.map +1 -0
  7. package/dist/core/store-validation.d.ts.map +1 -1
  8. package/dist/core/store-validation.js +2 -1
  9. package/dist/core/store-validation.js.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +4 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/presentation/routes/auth.d.ts +1 -1
  15. package/dist/presentation/routes/auth.d.ts.map +1 -1
  16. package/dist/presentation/routes/auth.js +1 -1
  17. package/dist/presentation/routes/auth.js.map +1 -1
  18. package/dist/presentation/routes/index.d.ts +1 -1
  19. package/dist/presentation/routes/index.d.ts.map +1 -1
  20. package/dist/presentation/routes/index.js.map +1 -1
  21. package/dist/presentation/routes/warnings.d.ts.map +1 -1
  22. package/dist/presentation/routes/warnings.js +4 -3
  23. package/dist/presentation/routes/warnings.js.map +1 -1
  24. package/dist/tsconfig.test.tsbuildinfo +1 -1
  25. package/package.json +15 -16
  26. package/src/core/identifier-policy.test.ts +25 -0
  27. package/src/core/identifier-policy.ts +13 -0
  28. package/src/core/store-validation.ts +2 -1
  29. package/src/index.ts +3 -3
  30. package/src/presentation/routes/auth.ts +4 -1
  31. package/src/presentation/routes/index.ts +1 -1
  32. package/src/presentation/routes/management.test.ts +1 -1
  33. package/src/presentation/routes/warnings.ts +3 -6
  34. package/tsconfig.build.tsbuildinfo +1 -1
@@ -1,2 +1,2 @@
1
1
  $ shipfox-swc
2
- Successfully compiled: 52 files with swc (576.27ms)
2
+ Successfully compiled: 53 files with swc (468.35ms)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @shipfox/api-secrets
2
2
 
3
+ ## 9.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 475ce59: Republishes all public packages after restoring release authorization.
8
+ - Updated dependencies [8436596]
9
+ - Updated dependencies [475ce59]
10
+ - Updated dependencies [154e03f]
11
+ - @shipfox/api-secrets-dto@9.0.1
12
+ - @shipfox/api-auth-context@9.0.1
13
+ - @shipfox/api-projects-dto@9.0.1
14
+ - @shipfox/config@1.2.3
15
+ - @shipfox/inter-module@0.2.1
16
+ - @shipfox/node-drizzle@0.3.3
17
+ - @shipfox/node-fastify@0.3.1
18
+ - @shipfox/node-module@1.0.0
19
+ - @shipfox/node-opentelemetry@0.6.1
20
+ - @shipfox/node-outbox@0.2.5
21
+ - @shipfox/node-postgres@0.4.3
22
+
23
+ ## 9.0.0
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [02974d6]
28
+ - @shipfox/api-secrets-dto@9.0.0
29
+ - @shipfox/api-auth-context@9.0.0
30
+ - @shipfox/api-projects-dto@8.0.0
31
+ - @shipfox/config@1.2.2
32
+ - @shipfox/inter-module@0.2.0
33
+ - @shipfox/node-drizzle@0.3.2
34
+ - @shipfox/node-fastify@0.3.0
35
+ - @shipfox/node-module@0.5.0
36
+ - @shipfox/node-opentelemetry@0.6.0
37
+ - @shipfox/node-outbox@0.2.4
38
+ - @shipfox/node-postgres@0.4.2
39
+
40
+ ## 8.0.0
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies [7f227c6]
45
+ - @shipfox/api-projects-dto@8.0.0
46
+
3
47
  ## 7.1.0
4
48
 
5
49
  ### Patch Changes
@@ -0,0 +1,4 @@
1
+ export declare function isSystemNamespace(namespace: string): boolean;
2
+ export declare function isSensitiveSecretName(key: string): boolean;
3
+ export declare function isShortSecretValue(value: string, threshold: number): boolean;
4
+ //# sourceMappingURL=identifier-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifier-policy.d.ts","sourceRoot":"","sources":["../../src/core/identifier-policy.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAE5E"}
@@ -0,0 +1,12 @@
1
+ import { SENSITIVE_NAME_PATTERNS, SYSTEM_NAMESPACE_PREFIX } from '@shipfox/api-secrets-dto';
2
+ export function isSystemNamespace(namespace) {
3
+ return namespace.startsWith(SYSTEM_NAMESPACE_PREFIX);
4
+ }
5
+ export function isSensitiveSecretName(key) {
6
+ return SENSITIVE_NAME_PATTERNS.some((pattern)=>key.includes(pattern));
7
+ }
8
+ export function isShortSecretValue(value, threshold) {
9
+ return value.length > 0 && value.length < threshold;
10
+ }
11
+
12
+ //# sourceMappingURL=identifier-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/identifier-policy.ts"],"sourcesContent":["import {SENSITIVE_NAME_PATTERNS, SYSTEM_NAMESPACE_PREFIX} from '@shipfox/api-secrets-dto';\n\nexport function isSystemNamespace(namespace: string): boolean {\n return namespace.startsWith(SYSTEM_NAMESPACE_PREFIX);\n}\n\nexport function isSensitiveSecretName(key: string): boolean {\n return SENSITIVE_NAME_PATTERNS.some((pattern) => key.includes(pattern));\n}\n\nexport function isShortSecretValue(value: string, threshold: number): boolean {\n return value.length > 0 && value.length < threshold;\n}\n"],"names":["SENSITIVE_NAME_PATTERNS","SYSTEM_NAMESPACE_PREFIX","isSystemNamespace","namespace","startsWith","isSensitiveSecretName","key","some","pattern","includes","isShortSecretValue","value","threshold","length"],"mappings":"AAAA,SAAQA,uBAAuB,EAAEC,uBAAuB,QAAO,2BAA2B;AAE1F,OAAO,SAASC,kBAAkBC,SAAiB;IACjD,OAAOA,UAAUC,UAAU,CAACH;AAC9B;AAEA,OAAO,SAASI,sBAAsBC,GAAW;IAC/C,OAAON,wBAAwBO,IAAI,CAAC,CAACC,UAAYF,IAAIG,QAAQ,CAACD;AAChE;AAEA,OAAO,SAASE,mBAAmBC,KAAa,EAAEC,SAAiB;IACjE,OAAOD,MAAME,MAAM,GAAG,KAAKF,MAAME,MAAM,GAAGD;AAC5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"store-validation.d.ts","sourceRoot":"","sources":["../../src/core/store-validation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,KAAK,EAAE,EAAC,MAAM,cAAc,CAAC;AAQ5D,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGzD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAI/D;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAMjE;AAED,wBAAsB,kBAAkB,CAAC,MAAM,EAAE;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,EAAE,EAAE,EAAE,CAAC;CACR,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhB"}
1
+ {"version":3,"file":"store-validation.d.ts","sourceRoot":"","sources":["../../src/core/store-validation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,KAAK,EAAE,EAAC,MAAM,cAAc,CAAC;AAS5D,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGzD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAI/D;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAMjE;AAED,wBAAsB,kBAAkB,CAAC,MAAM,EAAE;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,EAAE,EAAE,EAAE,CAAC;CACR,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhB"}
@@ -1,7 +1,8 @@
1
- import { isSystemNamespace, namespaceSchema, secretKeySchema } from '@shipfox/api-secrets-dto';
1
+ import { namespaceSchema, secretKeySchema } from '@shipfox/api-secrets-dto';
2
2
  import { config, MAX_VALUE_BYTES } from '#config.js';
3
3
  import { countWorkspaceEntries } from '#db/index.js';
4
4
  import { NamespaceValidationError, SecretKeyValidationError, SecretValueTooLargeError, WorkspaceSecretCapExceededError } from './errors.js';
5
+ import { isSystemNamespace } from './identifier-policy.js';
5
6
  export function validateNamespace(namespace) {
6
7
  if (namespaceSchema.safeParse(namespace).success) return;
7
8
  throw new NamespaceValidationError(namespace);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/store-validation.ts"],"sourcesContent":["import {isSystemNamespace, namespaceSchema, secretKeySchema} from '@shipfox/api-secrets-dto';\nimport {config, MAX_VALUE_BYTES} from '#config.js';\nimport {countWorkspaceEntries, type Tx} from '#db/index.js';\nimport {\n NamespaceValidationError,\n SecretKeyValidationError,\n SecretValueTooLargeError,\n WorkspaceSecretCapExceededError,\n} from './errors.js';\n\nexport function validateNamespace(namespace: string): void {\n if (namespaceSchema.safeParse(namespace).success) return;\n throw new NamespaceValidationError(namespace);\n}\n\nexport function validateSecretKeys(keys: Iterable<string>): void {\n for (const key of keys) {\n if (!secretKeySchema.safeParse(key).success) throw new SecretKeyValidationError(key);\n }\n}\n\nexport function validateValueBytes(values: Iterable<string>): void {\n for (const value of values) {\n if (Buffer.byteLength(value, 'utf8') > MAX_VALUE_BYTES) {\n throw new SecretValueTooLargeError(MAX_VALUE_BYTES);\n }\n }\n}\n\nexport async function assertWorkspaceCap(params: {\n workspaceId: string;\n namespace: string;\n incomingEntries: number;\n tx: Tx;\n}): Promise<void> {\n // System namespaces are internal-only; public management routes do not accept a namespace.\n if (isSystemNamespace(params.namespace)) return;\n\n const count = await countWorkspaceEntries(params.workspaceId, params.tx);\n if (count + params.incomingEntries > config.SECRETS_MAX_PER_WORKSPACE) {\n throw new WorkspaceSecretCapExceededError(params.workspaceId, config.SECRETS_MAX_PER_WORKSPACE);\n }\n}\n"],"names":["isSystemNamespace","namespaceSchema","secretKeySchema","config","MAX_VALUE_BYTES","countWorkspaceEntries","NamespaceValidationError","SecretKeyValidationError","SecretValueTooLargeError","WorkspaceSecretCapExceededError","validateNamespace","namespace","safeParse","success","validateSecretKeys","keys","key","validateValueBytes","values","value","Buffer","byteLength","assertWorkspaceCap","params","count","workspaceId","tx","incomingEntries","SECRETS_MAX_PER_WORKSPACE"],"mappings":"AAAA,SAAQA,iBAAiB,EAAEC,eAAe,EAAEC,eAAe,QAAO,2BAA2B;AAC7F,SAAQC,MAAM,EAAEC,eAAe,QAAO,aAAa;AACnD,SAAQC,qBAAqB,QAAgB,eAAe;AAC5D,SACEC,wBAAwB,EACxBC,wBAAwB,EACxBC,wBAAwB,EACxBC,+BAA+B,QAC1B,cAAc;AAErB,OAAO,SAASC,kBAAkBC,SAAiB;IACjD,IAAIV,gBAAgBW,SAAS,CAACD,WAAWE,OAAO,EAAE;IAClD,MAAM,IAAIP,yBAAyBK;AACrC;AAEA,OAAO,SAASG,mBAAmBC,IAAsB;IACvD,KAAK,MAAMC,OAAOD,KAAM;QACtB,IAAI,CAACb,gBAAgBU,SAAS,CAACI,KAAKH,OAAO,EAAE,MAAM,IAAIN,yBAAyBS;IAClF;AACF;AAEA,OAAO,SAASC,mBAAmBC,MAAwB;IACzD,KAAK,MAAMC,SAASD,OAAQ;QAC1B,IAAIE,OAAOC,UAAU,CAACF,OAAO,UAAUf,iBAAiB;YACtD,MAAM,IAAII,yBAAyBJ;QACrC;IACF;AACF;AAEA,OAAO,eAAekB,mBAAmBC,MAKxC;IACC,2FAA2F;IAC3F,IAAIvB,kBAAkBuB,OAAOZ,SAAS,GAAG;IAEzC,MAAMa,QAAQ,MAAMnB,sBAAsBkB,OAAOE,WAAW,EAAEF,OAAOG,EAAE;IACvE,IAAIF,QAAQD,OAAOI,eAAe,GAAGxB,OAAOyB,yBAAyB,EAAE;QACrE,MAAM,IAAInB,gCAAgCc,OAAOE,WAAW,EAAEtB,OAAOyB,yBAAyB;IAChG;AACF"}
1
+ {"version":3,"sources":["../../src/core/store-validation.ts"],"sourcesContent":["import {namespaceSchema, secretKeySchema} from '@shipfox/api-secrets-dto';\nimport {config, MAX_VALUE_BYTES} from '#config.js';\nimport {countWorkspaceEntries, type Tx} from '#db/index.js';\nimport {\n NamespaceValidationError,\n SecretKeyValidationError,\n SecretValueTooLargeError,\n WorkspaceSecretCapExceededError,\n} from './errors.js';\nimport {isSystemNamespace} from './identifier-policy.js';\n\nexport function validateNamespace(namespace: string): void {\n if (namespaceSchema.safeParse(namespace).success) return;\n throw new NamespaceValidationError(namespace);\n}\n\nexport function validateSecretKeys(keys: Iterable<string>): void {\n for (const key of keys) {\n if (!secretKeySchema.safeParse(key).success) throw new SecretKeyValidationError(key);\n }\n}\n\nexport function validateValueBytes(values: Iterable<string>): void {\n for (const value of values) {\n if (Buffer.byteLength(value, 'utf8') > MAX_VALUE_BYTES) {\n throw new SecretValueTooLargeError(MAX_VALUE_BYTES);\n }\n }\n}\n\nexport async function assertWorkspaceCap(params: {\n workspaceId: string;\n namespace: string;\n incomingEntries: number;\n tx: Tx;\n}): Promise<void> {\n // System namespaces are internal-only; public management routes do not accept a namespace.\n if (isSystemNamespace(params.namespace)) return;\n\n const count = await countWorkspaceEntries(params.workspaceId, params.tx);\n if (count + params.incomingEntries > config.SECRETS_MAX_PER_WORKSPACE) {\n throw new WorkspaceSecretCapExceededError(params.workspaceId, config.SECRETS_MAX_PER_WORKSPACE);\n }\n}\n"],"names":["namespaceSchema","secretKeySchema","config","MAX_VALUE_BYTES","countWorkspaceEntries","NamespaceValidationError","SecretKeyValidationError","SecretValueTooLargeError","WorkspaceSecretCapExceededError","isSystemNamespace","validateNamespace","namespace","safeParse","success","validateSecretKeys","keys","key","validateValueBytes","values","value","Buffer","byteLength","assertWorkspaceCap","params","count","workspaceId","tx","incomingEntries","SECRETS_MAX_PER_WORKSPACE"],"mappings":"AAAA,SAAQA,eAAe,EAAEC,eAAe,QAAO,2BAA2B;AAC1E,SAAQC,MAAM,EAAEC,eAAe,QAAO,aAAa;AACnD,SAAQC,qBAAqB,QAAgB,eAAe;AAC5D,SACEC,wBAAwB,EACxBC,wBAAwB,EACxBC,wBAAwB,EACxBC,+BAA+B,QAC1B,cAAc;AACrB,SAAQC,iBAAiB,QAAO,yBAAyB;AAEzD,OAAO,SAASC,kBAAkBC,SAAiB;IACjD,IAAIX,gBAAgBY,SAAS,CAACD,WAAWE,OAAO,EAAE;IAClD,MAAM,IAAIR,yBAAyBM;AACrC;AAEA,OAAO,SAASG,mBAAmBC,IAAsB;IACvD,KAAK,MAAMC,OAAOD,KAAM;QACtB,IAAI,CAACd,gBAAgBW,SAAS,CAACI,KAAKH,OAAO,EAAE,MAAM,IAAIP,yBAAyBU;IAClF;AACF;AAEA,OAAO,SAASC,mBAAmBC,MAAwB;IACzD,KAAK,MAAMC,SAASD,OAAQ;QAC1B,IAAIE,OAAOC,UAAU,CAACF,OAAO,UAAUhB,iBAAiB;YACtD,MAAM,IAAII,yBAAyBJ;QACrC;IACF;AACF;AAEA,OAAO,eAAemB,mBAAmBC,MAKxC;IACC,2FAA2F;IAC3F,IAAId,kBAAkBc,OAAOZ,SAAS,GAAG;IAEzC,MAAMa,QAAQ,MAAMpB,sBAAsBmB,OAAOE,WAAW,EAAEF,OAAOG,EAAE;IACvE,IAAIF,QAAQD,OAAOI,eAAe,GAAGzB,OAAO0B,yBAAyB,EAAE;QACrE,MAAM,IAAIpB,gCAAgCe,OAAOE,WAAW,EAAEvB,OAAO0B,yBAAyB;IAChG;AACF"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ProjectsModuleClient } from '@shipfox/api-projects-dto';
1
+ import type { ProjectsModuleClient } from '@shipfox/api-projects-dto/inter-module';
2
2
  import type { ShipfoxModule } from '@shipfox/node-module';
3
3
  export { BUILTIN_LOCAL_STORE, DekUnwrapError, DekWrapError, deleteManagedSecret, deleteManagedVariable, deleteSecrets, deleteVariables, getManagedVariable, getSecret, getSecretsByNamespace, getVariable, getVariablesByNamespace, KekConfigurationError, KekVersionStrandedError, listManagedSecrets, listManagedVariables, NamespaceValidationError, resolveSecretStore, rotateWorkspaceDataKeys, SecretBatchScopeMismatchError, SecretDecryptionError, SecretKeyValidationError, SecretNotFoundError, type SecretStoreProvider, SecretValueTooLargeError, setManagedSecrets, setManagedVariables, setSecrets, setVariables, UnknownSecretStoreError, VariableNotFoundError, WorkspaceSecretCapExceededError, } from '#core/index.js';
4
4
  export declare function createSecretsModule(projects: ProjectsModuleClient): ShipfoxModule;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAEpE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAOxD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,gBAAgB,CAAC;AAExB,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,aAAa,CAUjF;AAGD,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AAEjF,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAOxD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,gBAAgB,CAAC;AAExB,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,aAAa,CAUjF;AAGD,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC"}
package/dist/index.js CHANGED
@@ -10,7 +10,8 @@ export function createSecretsModule(projects) {
10
10
  name: 'secrets',
11
11
  database: {
12
12
  db,
13
- migrationsPath
13
+ migrationsPath,
14
+ databaseNamespace: 'secrets'
14
15
  },
15
16
  routes: createSecretsRoutes(projects),
16
17
  e2eRoutes: [
@@ -35,7 +36,8 @@ export const secretsModule = {
35
36
  name: 'secrets',
36
37
  database: {
37
38
  db,
38
- migrationsPath
39
+ migrationsPath,
40
+ databaseNamespace: 'secrets'
39
41
  }
40
42
  };
41
43
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';\nimport {secretsEventSchemas} from '@shipfox/api-secrets-dto';\nimport type {ShipfoxModule} from '@shipfox/node-module';\nimport {db, migrationsPath, secretsOutbox} from '#db/index.js';\nimport {registerSecretsServiceMetrics} from '#metrics/index.js';\nimport {secretsE2eRoutes} from '#presentation/e2eRoutes/index.js';\nimport {createSecretsInterModulePresentation} from '#presentation/inter-module.js';\nimport {createSecretsRoutes} from '#presentation/routes/index.js';\n\nexport {\n BUILTIN_LOCAL_STORE,\n DekUnwrapError,\n DekWrapError,\n deleteManagedSecret,\n deleteManagedVariable,\n deleteSecrets,\n deleteVariables,\n getManagedVariable,\n getSecret,\n getSecretsByNamespace,\n getVariable,\n getVariablesByNamespace,\n KekConfigurationError,\n KekVersionStrandedError,\n listManagedSecrets,\n listManagedVariables,\n NamespaceValidationError,\n resolveSecretStore,\n rotateWorkspaceDataKeys,\n SecretBatchScopeMismatchError,\n SecretDecryptionError,\n SecretKeyValidationError,\n SecretNotFoundError,\n type SecretStoreProvider,\n SecretValueTooLargeError,\n setManagedSecrets,\n setManagedVariables,\n setSecrets,\n setVariables,\n UnknownSecretStoreError,\n VariableNotFoundError,\n WorkspaceSecretCapExceededError,\n} from '#core/index.js';\n\nexport function createSecretsModule(projects: ProjectsModuleClient): ShipfoxModule {\n return {\n name: 'secrets',\n database: {db, migrationsPath},\n routes: createSecretsRoutes(projects),\n e2eRoutes: [secretsE2eRoutes],\n metrics: registerSecretsServiceMetrics,\n publishers: [{name: 'secrets', table: secretsOutbox, db, eventSchemas: secretsEventSchemas}],\n interModulePresentations: [createSecretsInterModulePresentation()],\n };\n}\n\n// Migration setup imports this declaration only for the owned database metadata.\nexport const secretsModule: ShipfoxModule = {\n name: 'secrets',\n database: {db, migrationsPath},\n};\n"],"names":["secretsEventSchemas","db","migrationsPath","secretsOutbox","registerSecretsServiceMetrics","secretsE2eRoutes","createSecretsInterModulePresentation","createSecretsRoutes","BUILTIN_LOCAL_STORE","DekUnwrapError","DekWrapError","deleteManagedSecret","deleteManagedVariable","deleteSecrets","deleteVariables","getManagedVariable","getSecret","getSecretsByNamespace","getVariable","getVariablesByNamespace","KekConfigurationError","KekVersionStrandedError","listManagedSecrets","listManagedVariables","NamespaceValidationError","resolveSecretStore","rotateWorkspaceDataKeys","SecretBatchScopeMismatchError","SecretDecryptionError","SecretKeyValidationError","SecretNotFoundError","SecretValueTooLargeError","setManagedSecrets","setManagedVariables","setSecrets","setVariables","UnknownSecretStoreError","VariableNotFoundError","WorkspaceSecretCapExceededError","createSecretsModule","projects","name","database","routes","e2eRoutes","metrics","publishers","table","eventSchemas","interModulePresentations","secretsModule"],"mappings":"AACA,SAAQA,mBAAmB,QAAO,2BAA2B;AAE7D,SAAQC,EAAE,EAAEC,cAAc,EAAEC,aAAa,QAAO,eAAe;AAC/D,SAAQC,6BAA6B,QAAO,oBAAoB;AAChE,SAAQC,gBAAgB,QAAO,mCAAmC;AAClE,SAAQC,oCAAoC,QAAO,gCAAgC;AACnF,SAAQC,mBAAmB,QAAO,gCAAgC;AAElE,SACEC,mBAAmB,EACnBC,cAAc,EACdC,YAAY,EACZC,mBAAmB,EACnBC,qBAAqB,EACrBC,aAAa,EACbC,eAAe,EACfC,kBAAkB,EAClBC,SAAS,EACTC,qBAAqB,EACrBC,WAAW,EACXC,uBAAuB,EACvBC,qBAAqB,EACrBC,uBAAuB,EACvBC,kBAAkB,EAClBC,oBAAoB,EACpBC,wBAAwB,EACxBC,kBAAkB,EAClBC,uBAAuB,EACvBC,6BAA6B,EAC7BC,qBAAqB,EACrBC,wBAAwB,EACxBC,mBAAmB,EAEnBC,wBAAwB,EACxBC,iBAAiB,EACjBC,mBAAmB,EACnBC,UAAU,EACVC,YAAY,EACZC,uBAAuB,EACvBC,qBAAqB,EACrBC,+BAA+B,QAC1B,iBAAiB;AAExB,OAAO,SAASC,oBAAoBC,QAA8B;IAChE,OAAO;QACLC,MAAM;QACNC,UAAU;YAACzC;YAAIC;QAAc;QAC7ByC,QAAQpC,oBAAoBiC;QAC5BI,WAAW;YAACvC;SAAiB;QAC7BwC,SAASzC;QACT0C,YAAY;YAAC;gBAACL,MAAM;gBAAWM,OAAO5C;gBAAeF;gBAAI+C,cAAchD;YAAmB;SAAE;QAC5FiD,0BAA0B;YAAC3C;SAAuC;IACpE;AACF;AAEA,iFAAiF;AACjF,OAAO,MAAM4C,gBAA+B;IAC1CT,MAAM;IACNC,UAAU;QAACzC;QAAIC;IAAc;AAC/B,EAAE"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport {secretsEventSchemas} from '@shipfox/api-secrets-dto';\nimport type {ShipfoxModule} from '@shipfox/node-module';\nimport {db, migrationsPath, secretsOutbox} from '#db/index.js';\nimport {registerSecretsServiceMetrics} from '#metrics/index.js';\nimport {secretsE2eRoutes} from '#presentation/e2eRoutes/index.js';\nimport {createSecretsInterModulePresentation} from '#presentation/inter-module.js';\nimport {createSecretsRoutes} from '#presentation/routes/index.js';\n\nexport {\n BUILTIN_LOCAL_STORE,\n DekUnwrapError,\n DekWrapError,\n deleteManagedSecret,\n deleteManagedVariable,\n deleteSecrets,\n deleteVariables,\n getManagedVariable,\n getSecret,\n getSecretsByNamespace,\n getVariable,\n getVariablesByNamespace,\n KekConfigurationError,\n KekVersionStrandedError,\n listManagedSecrets,\n listManagedVariables,\n NamespaceValidationError,\n resolveSecretStore,\n rotateWorkspaceDataKeys,\n SecretBatchScopeMismatchError,\n SecretDecryptionError,\n SecretKeyValidationError,\n SecretNotFoundError,\n type SecretStoreProvider,\n SecretValueTooLargeError,\n setManagedSecrets,\n setManagedVariables,\n setSecrets,\n setVariables,\n UnknownSecretStoreError,\n VariableNotFoundError,\n WorkspaceSecretCapExceededError,\n} from '#core/index.js';\n\nexport function createSecretsModule(projects: ProjectsModuleClient): ShipfoxModule {\n return {\n name: 'secrets',\n database: {db, migrationsPath, databaseNamespace: 'secrets'},\n routes: createSecretsRoutes(projects),\n e2eRoutes: [secretsE2eRoutes],\n metrics: registerSecretsServiceMetrics,\n publishers: [{name: 'secrets', table: secretsOutbox, db, eventSchemas: secretsEventSchemas}],\n interModulePresentations: [createSecretsInterModulePresentation()],\n };\n}\n\n// Migration setup imports this declaration only for the owned database metadata.\nexport const secretsModule: ShipfoxModule = {\n name: 'secrets',\n database: {db, migrationsPath, databaseNamespace: 'secrets'},\n};\n"],"names":["secretsEventSchemas","db","migrationsPath","secretsOutbox","registerSecretsServiceMetrics","secretsE2eRoutes","createSecretsInterModulePresentation","createSecretsRoutes","BUILTIN_LOCAL_STORE","DekUnwrapError","DekWrapError","deleteManagedSecret","deleteManagedVariable","deleteSecrets","deleteVariables","getManagedVariable","getSecret","getSecretsByNamespace","getVariable","getVariablesByNamespace","KekConfigurationError","KekVersionStrandedError","listManagedSecrets","listManagedVariables","NamespaceValidationError","resolveSecretStore","rotateWorkspaceDataKeys","SecretBatchScopeMismatchError","SecretDecryptionError","SecretKeyValidationError","SecretNotFoundError","SecretValueTooLargeError","setManagedSecrets","setManagedVariables","setSecrets","setVariables","UnknownSecretStoreError","VariableNotFoundError","WorkspaceSecretCapExceededError","createSecretsModule","projects","name","database","databaseNamespace","routes","e2eRoutes","metrics","publishers","table","eventSchemas","interModulePresentations","secretsModule"],"mappings":"AACA,SAAQA,mBAAmB,QAAO,2BAA2B;AAE7D,SAAQC,EAAE,EAAEC,cAAc,EAAEC,aAAa,QAAO,eAAe;AAC/D,SAAQC,6BAA6B,QAAO,oBAAoB;AAChE,SAAQC,gBAAgB,QAAO,mCAAmC;AAClE,SAAQC,oCAAoC,QAAO,gCAAgC;AACnF,SAAQC,mBAAmB,QAAO,gCAAgC;AAElE,SACEC,mBAAmB,EACnBC,cAAc,EACdC,YAAY,EACZC,mBAAmB,EACnBC,qBAAqB,EACrBC,aAAa,EACbC,eAAe,EACfC,kBAAkB,EAClBC,SAAS,EACTC,qBAAqB,EACrBC,WAAW,EACXC,uBAAuB,EACvBC,qBAAqB,EACrBC,uBAAuB,EACvBC,kBAAkB,EAClBC,oBAAoB,EACpBC,wBAAwB,EACxBC,kBAAkB,EAClBC,uBAAuB,EACvBC,6BAA6B,EAC7BC,qBAAqB,EACrBC,wBAAwB,EACxBC,mBAAmB,EAEnBC,wBAAwB,EACxBC,iBAAiB,EACjBC,mBAAmB,EACnBC,UAAU,EACVC,YAAY,EACZC,uBAAuB,EACvBC,qBAAqB,EACrBC,+BAA+B,QAC1B,iBAAiB;AAExB,OAAO,SAASC,oBAAoBC,QAA8B;IAChE,OAAO;QACLC,MAAM;QACNC,UAAU;YAACzC;YAAIC;YAAgByC,mBAAmB;QAAS;QAC3DC,QAAQrC,oBAAoBiC;QAC5BK,WAAW;YAACxC;SAAiB;QAC7ByC,SAAS1C;QACT2C,YAAY;YAAC;gBAACN,MAAM;gBAAWO,OAAO7C;gBAAeF;gBAAIgD,cAAcjD;YAAmB;SAAE;QAC5FkD,0BAA0B;YAAC5C;SAAuC;IACpE;AACF;AAEA,iFAAiF;AACjF,OAAO,MAAM6C,gBAA+B;IAC1CV,MAAM;IACNC,UAAU;QAACzC;QAAIC;QAAgByC,mBAAmB;IAAS;AAC7D,EAAE"}
@@ -1,4 +1,4 @@
1
- import { type ProjectsModuleClient } from '@shipfox/api-projects-dto';
1
+ import { type ProjectsModuleClient } from '@shipfox/api-projects-dto/inter-module';
2
2
  import type { FastifyRequest } from 'fastify';
3
3
  export interface ManagementAccess {
4
4
  workspaceId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,oBAAoB,EAA8B,MAAM,2BAA2B,CAAC;AAGjG,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,qBAAqB,CAAC,MAAM,EAAE;QAC5B,OAAO,EAAE,cAAc,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAChC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9B,sBAAsB,CAAC,MAAM,EAAE;QAC7B,OAAO,EAAE,cAAc,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAChC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC/B;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,uBAAuB,CAa9F"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/auth.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,wCAAwC,CAAC;AAGhD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,qBAAqB,CAAC,MAAM,EAAE;QAC5B,OAAO,EAAE,cAAc,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAChC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9B,sBAAsB,CAAC,MAAM,EAAE;QAC7B,OAAO,EAAE,cAAc,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAChC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC/B;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,uBAAuB,CAa9F"}
@@ -1,5 +1,5 @@
1
1
  import { requireWorkspaceAccess } from '@shipfox/api-auth-context';
2
- import { projectsInterModuleContract } from '@shipfox/api-projects-dto';
2
+ import { projectsInterModuleContract } from '@shipfox/api-projects-dto/inter-module';
3
3
  import { isInterModuleKnownError } from '@shipfox/inter-module';
4
4
  import { ClientError } from '@shipfox/node-fastify';
5
5
  export function createManagementAccess(projects) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/presentation/routes/auth.ts"],"sourcesContent":["import {requireWorkspaceAccess} from '@shipfox/api-auth-context';\nimport {type ProjectsModuleClient, projectsInterModuleContract} from '@shipfox/api-projects-dto';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport {ClientError} from '@shipfox/node-fastify';\nimport type {FastifyRequest} from 'fastify';\n\nexport interface ManagementAccess {\n workspaceId: string;\n userId: string;\n}\n\nexport interface ManagementAccessHelpers {\n requireManagementRead(params: {\n request: FastifyRequest;\n workspaceId: string;\n projectId?: string | undefined;\n }): Promise<ManagementAccess>;\n requireManagementWrite(params: {\n request: FastifyRequest;\n workspaceId: string;\n projectId?: string | undefined;\n }): Promise<ManagementAccess>;\n}\n\nexport function createManagementAccess(projects: ProjectsModuleClient): ManagementAccessHelpers {\n return {\n requireManagementRead: (params: {\n request: FastifyRequest;\n workspaceId: string;\n projectId?: string | undefined;\n }) => requireManagementRead(params, projects),\n requireManagementWrite: (params: {\n request: FastifyRequest;\n workspaceId: string;\n projectId?: string | undefined;\n }) => requireManagementWrite(params, projects),\n };\n}\n\nasync function requireManagementRead(\n params: {\n request: FastifyRequest;\n workspaceId: string;\n projectId?: string | undefined;\n },\n projects: ProjectsModuleClient,\n): Promise<ManagementAccess> {\n const membership = requireWorkspaceAccess({\n request: params.request,\n workspaceId: params.workspaceId,\n });\n if (params.projectId) {\n await requireProjectForWorkspace(params.workspaceId, params.projectId, projects);\n }\n\n return {workspaceId: params.workspaceId, userId: membership.userId};\n}\n\nasync function requireManagementWrite(\n params: {\n request: FastifyRequest;\n workspaceId: string;\n projectId?: string | undefined;\n },\n projects: ProjectsModuleClient,\n): Promise<ManagementAccess> {\n const membership = requireWorkspaceAccess({\n request: params.request,\n workspaceId: params.workspaceId,\n });\n if (membership.role !== 'admin') {\n throw new ClientError('Workspace admin role required', 'forbidden', {status: 403});\n }\n if (params.projectId) {\n await requireProjectForWorkspace(params.workspaceId, params.projectId, projects);\n }\n\n return {workspaceId: params.workspaceId, userId: membership.userId};\n}\n\nasync function requireProjectForWorkspace(\n workspaceId: string,\n projectId: string,\n projects: ProjectsModuleClient,\n): Promise<void> {\n try {\n await projects.requireProjectForWorkspace({workspaceId, projectId});\n } catch (error) {\n if (\n isInterModuleKnownError(projectsInterModuleContract.methods.requireProjectForWorkspace, error)\n ) {\n throw new ClientError('Project not found', 'project-not-found', {status: 404});\n }\n throw error;\n }\n}\n"],"names":["requireWorkspaceAccess","projectsInterModuleContract","isInterModuleKnownError","ClientError","createManagementAccess","projects","requireManagementRead","params","requireManagementWrite","membership","request","workspaceId","projectId","requireProjectForWorkspace","userId","role","status","error","methods"],"mappings":"AAAA,SAAQA,sBAAsB,QAAO,4BAA4B;AACjE,SAAmCC,2BAA2B,QAAO,4BAA4B;AACjG,SAAQC,uBAAuB,QAAO,wBAAwB;AAC9D,SAAQC,WAAW,QAAO,wBAAwB;AAqBlD,OAAO,SAASC,uBAAuBC,QAA8B;IACnE,OAAO;QACLC,uBAAuB,CAACC,SAIlBD,sBAAsBC,QAAQF;QACpCG,wBAAwB,CAACD,SAInBC,uBAAuBD,QAAQF;IACvC;AACF;AAEA,eAAeC,sBACbC,MAIC,EACDF,QAA8B;IAE9B,MAAMI,aAAaT,uBAAuB;QACxCU,SAASH,OAAOG,OAAO;QACvBC,aAAaJ,OAAOI,WAAW;IACjC;IACA,IAAIJ,OAAOK,SAAS,EAAE;QACpB,MAAMC,2BAA2BN,OAAOI,WAAW,EAAEJ,OAAOK,SAAS,EAAEP;IACzE;IAEA,OAAO;QAACM,aAAaJ,OAAOI,WAAW;QAAEG,QAAQL,WAAWK,MAAM;IAAA;AACpE;AAEA,eAAeN,uBACbD,MAIC,EACDF,QAA8B;IAE9B,MAAMI,aAAaT,uBAAuB;QACxCU,SAASH,OAAOG,OAAO;QACvBC,aAAaJ,OAAOI,WAAW;IACjC;IACA,IAAIF,WAAWM,IAAI,KAAK,SAAS;QAC/B,MAAM,IAAIZ,YAAY,iCAAiC,aAAa;YAACa,QAAQ;QAAG;IAClF;IACA,IAAIT,OAAOK,SAAS,EAAE;QACpB,MAAMC,2BAA2BN,OAAOI,WAAW,EAAEJ,OAAOK,SAAS,EAAEP;IACzE;IAEA,OAAO;QAACM,aAAaJ,OAAOI,WAAW;QAAEG,QAAQL,WAAWK,MAAM;IAAA;AACpE;AAEA,eAAeD,2BACbF,WAAmB,EACnBC,SAAiB,EACjBP,QAA8B;IAE9B,IAAI;QACF,MAAMA,SAASQ,0BAA0B,CAAC;YAACF;YAAaC;QAAS;IACnE,EAAE,OAAOK,OAAO;QACd,IACEf,wBAAwBD,4BAA4BiB,OAAO,CAACL,0BAA0B,EAAEI,QACxF;YACA,MAAM,IAAId,YAAY,qBAAqB,qBAAqB;gBAACa,QAAQ;YAAG;QAC9E;QACA,MAAMC;IACR;AACF"}
1
+ {"version":3,"sources":["../../../src/presentation/routes/auth.ts"],"sourcesContent":["import {requireWorkspaceAccess} from '@shipfox/api-auth-context';\nimport {\n type ProjectsModuleClient,\n projectsInterModuleContract,\n} from '@shipfox/api-projects-dto/inter-module';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport {ClientError} from '@shipfox/node-fastify';\nimport type {FastifyRequest} from 'fastify';\n\nexport interface ManagementAccess {\n workspaceId: string;\n userId: string;\n}\n\nexport interface ManagementAccessHelpers {\n requireManagementRead(params: {\n request: FastifyRequest;\n workspaceId: string;\n projectId?: string | undefined;\n }): Promise<ManagementAccess>;\n requireManagementWrite(params: {\n request: FastifyRequest;\n workspaceId: string;\n projectId?: string | undefined;\n }): Promise<ManagementAccess>;\n}\n\nexport function createManagementAccess(projects: ProjectsModuleClient): ManagementAccessHelpers {\n return {\n requireManagementRead: (params: {\n request: FastifyRequest;\n workspaceId: string;\n projectId?: string | undefined;\n }) => requireManagementRead(params, projects),\n requireManagementWrite: (params: {\n request: FastifyRequest;\n workspaceId: string;\n projectId?: string | undefined;\n }) => requireManagementWrite(params, projects),\n };\n}\n\nasync function requireManagementRead(\n params: {\n request: FastifyRequest;\n workspaceId: string;\n projectId?: string | undefined;\n },\n projects: ProjectsModuleClient,\n): Promise<ManagementAccess> {\n const membership = requireWorkspaceAccess({\n request: params.request,\n workspaceId: params.workspaceId,\n });\n if (params.projectId) {\n await requireProjectForWorkspace(params.workspaceId, params.projectId, projects);\n }\n\n return {workspaceId: params.workspaceId, userId: membership.userId};\n}\n\nasync function requireManagementWrite(\n params: {\n request: FastifyRequest;\n workspaceId: string;\n projectId?: string | undefined;\n },\n projects: ProjectsModuleClient,\n): Promise<ManagementAccess> {\n const membership = requireWorkspaceAccess({\n request: params.request,\n workspaceId: params.workspaceId,\n });\n if (membership.role !== 'admin') {\n throw new ClientError('Workspace admin role required', 'forbidden', {status: 403});\n }\n if (params.projectId) {\n await requireProjectForWorkspace(params.workspaceId, params.projectId, projects);\n }\n\n return {workspaceId: params.workspaceId, userId: membership.userId};\n}\n\nasync function requireProjectForWorkspace(\n workspaceId: string,\n projectId: string,\n projects: ProjectsModuleClient,\n): Promise<void> {\n try {\n await projects.requireProjectForWorkspace({workspaceId, projectId});\n } catch (error) {\n if (\n isInterModuleKnownError(projectsInterModuleContract.methods.requireProjectForWorkspace, error)\n ) {\n throw new ClientError('Project not found', 'project-not-found', {status: 404});\n }\n throw error;\n }\n}\n"],"names":["requireWorkspaceAccess","projectsInterModuleContract","isInterModuleKnownError","ClientError","createManagementAccess","projects","requireManagementRead","params","requireManagementWrite","membership","request","workspaceId","projectId","requireProjectForWorkspace","userId","role","status","error","methods"],"mappings":"AAAA,SAAQA,sBAAsB,QAAO,4BAA4B;AACjE,SAEEC,2BAA2B,QACtB,yCAAyC;AAChD,SAAQC,uBAAuB,QAAO,wBAAwB;AAC9D,SAAQC,WAAW,QAAO,wBAAwB;AAqBlD,OAAO,SAASC,uBAAuBC,QAA8B;IACnE,OAAO;QACLC,uBAAuB,CAACC,SAIlBD,sBAAsBC,QAAQF;QACpCG,wBAAwB,CAACD,SAInBC,uBAAuBD,QAAQF;IACvC;AACF;AAEA,eAAeC,sBACbC,MAIC,EACDF,QAA8B;IAE9B,MAAMI,aAAaT,uBAAuB;QACxCU,SAASH,OAAOG,OAAO;QACvBC,aAAaJ,OAAOI,WAAW;IACjC;IACA,IAAIJ,OAAOK,SAAS,EAAE;QACpB,MAAMC,2BAA2BN,OAAOI,WAAW,EAAEJ,OAAOK,SAAS,EAAEP;IACzE;IAEA,OAAO;QAACM,aAAaJ,OAAOI,WAAW;QAAEG,QAAQL,WAAWK,MAAM;IAAA;AACpE;AAEA,eAAeN,uBACbD,MAIC,EACDF,QAA8B;IAE9B,MAAMI,aAAaT,uBAAuB;QACxCU,SAASH,OAAOG,OAAO;QACvBC,aAAaJ,OAAOI,WAAW;IACjC;IACA,IAAIF,WAAWM,IAAI,KAAK,SAAS;QAC/B,MAAM,IAAIZ,YAAY,iCAAiC,aAAa;YAACa,QAAQ;QAAG;IAClF;IACA,IAAIT,OAAOK,SAAS,EAAE;QACpB,MAAMC,2BAA2BN,OAAOI,WAAW,EAAEJ,OAAOK,SAAS,EAAEP;IACzE;IAEA,OAAO;QAACM,aAAaJ,OAAOI,WAAW;QAAEG,QAAQL,WAAWK,MAAM;IAAA;AACpE;AAEA,eAAeD,2BACbF,WAAmB,EACnBC,SAAiB,EACjBP,QAA8B;IAE9B,IAAI;QACF,MAAMA,SAASQ,0BAA0B,CAAC;YAACF;YAAaC;QAAS;IACnE,EAAE,OAAOK,OAAO;QACd,IACEf,wBAAwBD,4BAA4BiB,OAAO,CAACL,0BAA0B,EAAEI,QACxF;YACA,MAAM,IAAId,YAAY,qBAAqB,qBAAqB;gBAACa,QAAQ;YAAG;QAC9E;QACA,MAAMC;IACR;AACF"}
@@ -1,4 +1,4 @@
1
- import type { ProjectsModuleClient } from '@shipfox/api-projects-dto';
1
+ import type { ProjectsModuleClient } from '@shipfox/api-projects-dto/inter-module';
2
2
  import type { RouteGroup } from '@shipfox/node-fastify';
3
3
  export declare function createSecretsRoutes(projects: ProjectsModuleClient): RouteGroup[];
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAYtD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,UAAU,EAAE,CAmBhF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAYtD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,UAAU,EAAE,CAmBhF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/presentation/routes/index.ts"],"sourcesContent":["import {AUTH_USER} from '@shipfox/api-auth-context';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto';\nimport type {RouteGroup} from '@shipfox/node-fastify';\nimport {createManagementAccess} from './auth.js';\nimport {batchSecretsRoute} from './batch-secrets.js';\nimport {batchVariablesRoute} from './batch-variables.js';\nimport {deleteSecretRoute} from './delete-secret.js';\nimport {deleteVariableRoute} from './delete-variable.js';\nimport {getVariableRoute} from './get-variable.js';\nimport {listSecretsRoute} from './list-secrets.js';\nimport {listVariablesRoute} from './list-variables.js';\nimport {putSecretRoute} from './put-secret.js';\nimport {putVariableRoute} from './put-variable.js';\n\nexport function createSecretsRoutes(projects: ProjectsModuleClient): RouteGroup[] {\n const access = createManagementAccess(projects);\n return [\n {\n prefix: '/workspaces/:workspaceId',\n auth: AUTH_USER,\n routes: [\n listSecretsRoute(access),\n putSecretRoute(access),\n batchSecretsRoute(access),\n deleteSecretRoute(access),\n listVariablesRoute(access),\n getVariableRoute(access),\n putVariableRoute(access),\n batchVariablesRoute(access),\n deleteVariableRoute(access),\n ],\n },\n ];\n}\n"],"names":["AUTH_USER","createManagementAccess","batchSecretsRoute","batchVariablesRoute","deleteSecretRoute","deleteVariableRoute","getVariableRoute","listSecretsRoute","listVariablesRoute","putSecretRoute","putVariableRoute","createSecretsRoutes","projects","access","prefix","auth","routes"],"mappings":"AAAA,SAAQA,SAAS,QAAO,4BAA4B;AAGpD,SAAQC,sBAAsB,QAAO,YAAY;AACjD,SAAQC,iBAAiB,QAAO,qBAAqB;AACrD,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAAQC,iBAAiB,QAAO,qBAAqB;AACrD,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAAQC,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,kBAAkB,QAAO,sBAAsB;AACvD,SAAQC,cAAc,QAAO,kBAAkB;AAC/C,SAAQC,gBAAgB,QAAO,oBAAoB;AAEnD,OAAO,SAASC,oBAAoBC,QAA8B;IAChE,MAAMC,SAASZ,uBAAuBW;IACtC,OAAO;QACL;YACEE,QAAQ;YACRC,MAAMf;YACNgB,QAAQ;gBACNT,iBAAiBM;gBACjBJ,eAAeI;gBACfX,kBAAkBW;gBAClBT,kBAAkBS;gBAClBL,mBAAmBK;gBACnBP,iBAAiBO;gBACjBH,iBAAiBG;gBACjBV,oBAAoBU;gBACpBR,oBAAoBQ;aACrB;QACH;KACD;AACH"}
1
+ {"version":3,"sources":["../../../src/presentation/routes/index.ts"],"sourcesContent":["import {AUTH_USER} from '@shipfox/api-auth-context';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {RouteGroup} from '@shipfox/node-fastify';\nimport {createManagementAccess} from './auth.js';\nimport {batchSecretsRoute} from './batch-secrets.js';\nimport {batchVariablesRoute} from './batch-variables.js';\nimport {deleteSecretRoute} from './delete-secret.js';\nimport {deleteVariableRoute} from './delete-variable.js';\nimport {getVariableRoute} from './get-variable.js';\nimport {listSecretsRoute} from './list-secrets.js';\nimport {listVariablesRoute} from './list-variables.js';\nimport {putSecretRoute} from './put-secret.js';\nimport {putVariableRoute} from './put-variable.js';\n\nexport function createSecretsRoutes(projects: ProjectsModuleClient): RouteGroup[] {\n const access = createManagementAccess(projects);\n return [\n {\n prefix: '/workspaces/:workspaceId',\n auth: AUTH_USER,\n routes: [\n listSecretsRoute(access),\n putSecretRoute(access),\n batchSecretsRoute(access),\n deleteSecretRoute(access),\n listVariablesRoute(access),\n getVariableRoute(access),\n putVariableRoute(access),\n batchVariablesRoute(access),\n deleteVariableRoute(access),\n ],\n },\n ];\n}\n"],"names":["AUTH_USER","createManagementAccess","batchSecretsRoute","batchVariablesRoute","deleteSecretRoute","deleteVariableRoute","getVariableRoute","listSecretsRoute","listVariablesRoute","putSecretRoute","putVariableRoute","createSecretsRoutes","projects","access","prefix","auth","routes"],"mappings":"AAAA,SAAQA,SAAS,QAAO,4BAA4B;AAGpD,SAAQC,sBAAsB,QAAO,YAAY;AACjD,SAAQC,iBAAiB,QAAO,qBAAqB;AACrD,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAAQC,iBAAiB,QAAO,qBAAqB;AACrD,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAAQC,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,kBAAkB,QAAO,sBAAsB;AACvD,SAAQC,cAAc,QAAO,kBAAkB;AAC/C,SAAQC,gBAAgB,QAAO,oBAAoB;AAEnD,OAAO,SAASC,oBAAoBC,QAA8B;IAChE,MAAMC,SAASZ,uBAAuBW;IACtC,OAAO;QACL;YACEE,QAAQ;YACRC,MAAMf;YACNgB,QAAQ;gBACNT,iBAAiBM;gBACjBJ,eAAeI;gBACfX,kBAAkBW;gBAClBT,kBAAkBS;gBAClBL,mBAAmBK;gBACnBP,iBAAiBO;gBACjBH,iBAAiBG;gBACjBV,oBAAoBU;gBACpBR,oBAAoBQ;aACrB;QACH;KACD;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/warnings.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,qBAAqB,EAI3B,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAEpD,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,qBAAqB,EAAE,CAMlF;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,qBAAqB,EAAE,CAIpF"}
1
+ {"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/warnings.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAEpD,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,qBAAqB,EAAE,CAIlF;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,qBAAqB,EAAE,CAIpF"}
@@ -1,13 +1,14 @@
1
- import { SENSITIVE_VARIABLE_NAME_WARNING, SHORT_SECRET_VALUE_WARNING, shouldWarnSensitiveVariableName, shouldWarnShortSecretValue } from '@shipfox/api-secrets-dto';
1
+ import { SENSITIVE_VARIABLE_NAME_WARNING, SHORT_SECRET_VALUE_WARNING } from '@shipfox/api-secrets-dto';
2
2
  import { config } from '#config.js';
3
+ import { isSensitiveSecretName, isShortSecretValue } from '#core/identifier-policy.js';
3
4
  export function secretWarnings(entries) {
4
- return entries.filter((entry)=>shouldWarnShortSecretValue(entry.value, config.SECRETS_SHORT_VALUE_WARN_LENGTH)).map((entry)=>({
5
+ return entries.filter((entry)=>isShortSecretValue(entry.value, config.SECRETS_SHORT_VALUE_WARN_LENGTH)).map((entry)=>({
5
6
  code: SHORT_SECRET_VALUE_WARNING,
6
7
  key: entry.key
7
8
  }));
8
9
  }
9
10
  export function variableWarnings(entries) {
10
- return entries.filter((entry)=>shouldWarnSensitiveVariableName(entry.key)).map((entry)=>({
11
+ return entries.filter((entry)=>isSensitiveSecretName(entry.key)).map((entry)=>({
11
12
  code: SENSITIVE_VARIABLE_NAME_WARNING,
12
13
  key: entry.key
13
14
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/presentation/routes/warnings.ts"],"sourcesContent":["import {\n SENSITIVE_VARIABLE_NAME_WARNING,\n type SecretWriteWarningDto,\n SHORT_SECRET_VALUE_WARNING,\n shouldWarnSensitiveVariableName,\n shouldWarnShortSecretValue,\n} from '@shipfox/api-secrets-dto';\nimport {config} from '#config.js';\nimport type {ManagementEntry} from '#core/index.js';\n\nexport function secretWarnings(entries: ManagementEntry[]): SecretWriteWarningDto[] {\n return entries\n .filter((entry) =>\n shouldWarnShortSecretValue(entry.value, config.SECRETS_SHORT_VALUE_WARN_LENGTH),\n )\n .map((entry) => ({code: SHORT_SECRET_VALUE_WARNING, key: entry.key}));\n}\n\nexport function variableWarnings(entries: ManagementEntry[]): SecretWriteWarningDto[] {\n return entries\n .filter((entry) => shouldWarnSensitiveVariableName(entry.key))\n .map((entry) => ({code: SENSITIVE_VARIABLE_NAME_WARNING, key: entry.key}));\n}\n"],"names":["SENSITIVE_VARIABLE_NAME_WARNING","SHORT_SECRET_VALUE_WARNING","shouldWarnSensitiveVariableName","shouldWarnShortSecretValue","config","secretWarnings","entries","filter","entry","value","SECRETS_SHORT_VALUE_WARN_LENGTH","map","code","key","variableWarnings"],"mappings":"AAAA,SACEA,+BAA+B,EAE/BC,0BAA0B,EAC1BC,+BAA+B,EAC/BC,0BAA0B,QACrB,2BAA2B;AAClC,SAAQC,MAAM,QAAO,aAAa;AAGlC,OAAO,SAASC,eAAeC,OAA0B;IACvD,OAAOA,QACJC,MAAM,CAAC,CAACC,QACPL,2BAA2BK,MAAMC,KAAK,EAAEL,OAAOM,+BAA+B,GAE/EC,GAAG,CAAC,CAACH,QAAW,CAAA;YAACI,MAAMX;YAA4BY,KAAKL,MAAMK,GAAG;QAAA,CAAA;AACtE;AAEA,OAAO,SAASC,iBAAiBR,OAA0B;IACzD,OAAOA,QACJC,MAAM,CAAC,CAACC,QAAUN,gCAAgCM,MAAMK,GAAG,GAC3DF,GAAG,CAAC,CAACH,QAAW,CAAA;YAACI,MAAMZ;YAAiCa,KAAKL,MAAMK,GAAG;QAAA,CAAA;AAC3E"}
1
+ {"version":3,"sources":["../../../src/presentation/routes/warnings.ts"],"sourcesContent":["import {\n SENSITIVE_VARIABLE_NAME_WARNING,\n type SecretWriteWarningDto,\n SHORT_SECRET_VALUE_WARNING,\n} from '@shipfox/api-secrets-dto';\nimport {config} from '#config.js';\nimport {isSensitiveSecretName, isShortSecretValue} from '#core/identifier-policy.js';\nimport type {ManagementEntry} from '#core/index.js';\n\nexport function secretWarnings(entries: ManagementEntry[]): SecretWriteWarningDto[] {\n return entries\n .filter((entry) => isShortSecretValue(entry.value, config.SECRETS_SHORT_VALUE_WARN_LENGTH))\n .map((entry) => ({code: SHORT_SECRET_VALUE_WARNING, key: entry.key}));\n}\n\nexport function variableWarnings(entries: ManagementEntry[]): SecretWriteWarningDto[] {\n return entries\n .filter((entry) => isSensitiveSecretName(entry.key))\n .map((entry) => ({code: SENSITIVE_VARIABLE_NAME_WARNING, key: entry.key}));\n}\n"],"names":["SENSITIVE_VARIABLE_NAME_WARNING","SHORT_SECRET_VALUE_WARNING","config","isSensitiveSecretName","isShortSecretValue","secretWarnings","entries","filter","entry","value","SECRETS_SHORT_VALUE_WARN_LENGTH","map","code","key","variableWarnings"],"mappings":"AAAA,SACEA,+BAA+B,EAE/BC,0BAA0B,QACrB,2BAA2B;AAClC,SAAQC,MAAM,QAAO,aAAa;AAClC,SAAQC,qBAAqB,EAAEC,kBAAkB,QAAO,6BAA6B;AAGrF,OAAO,SAASC,eAAeC,OAA0B;IACvD,OAAOA,QACJC,MAAM,CAAC,CAACC,QAAUJ,mBAAmBI,MAAMC,KAAK,EAAEP,OAAOQ,+BAA+B,GACxFC,GAAG,CAAC,CAACH,QAAW,CAAA;YAACI,MAAMX;YAA4BY,KAAKL,MAAMK,GAAG;QAAA,CAAA;AACtE;AAEA,OAAO,SAASC,iBAAiBR,OAA0B;IACzD,OAAOA,QACJC,MAAM,CAAC,CAACC,QAAUL,sBAAsBK,MAAMK,GAAG,GACjDF,GAAG,CAAC,CAACH,QAAW,CAAA;YAACI,MAAMZ;YAAiCa,KAAKL,MAAMK,GAAG;QAAA,CAAA;AAC3E"}