@toa.io/pointer 0.20.0-dev.31 → 0.20.0-dev.35

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 (68) hide show
  1. package/package.json +15 -8
  2. package/readme.md +113 -76
  3. package/schemas/urimap.cos.yaml +2 -0
  4. package/source/Deployment.ts +90 -0
  5. package/source/annotation.test.ts +66 -0
  6. package/source/annotation.ts +46 -0
  7. package/source/createVariables.test.ts +186 -0
  8. package/source/createVariables.ts +12 -0
  9. package/source/index.ts +7 -0
  10. package/source/naming.ts +11 -0
  11. package/source/resolve.ts +53 -0
  12. package/tsconfig.json +12 -0
  13. package/source/.deployment/.variables/credentials.js +0 -35
  14. package/source/.deployment/.variables/index.js +0 -7
  15. package/source/.deployment/.variables/pointer.js +0 -18
  16. package/source/.deployment/index.js +0 -8
  17. package/source/.deployment/validate.js +0 -19
  18. package/source/.deployment/variables.js +0 -22
  19. package/source/.pointer/env.js +0 -44
  20. package/source/.pointer/index.js +0 -9
  21. package/source/.pointer/label.js +0 -15
  22. package/source/.pointer/local.js +0 -17
  23. package/source/deployment.js +0 -17
  24. package/source/index.js +0 -11
  25. package/source/pointer.js +0 -34
  26. package/source/uris/construct.js +0 -18
  27. package/source/uris/index.js +0 -9
  28. package/source/uris/normalize.js +0 -12
  29. package/source/uris/resolve.js +0 -18
  30. package/source/uris/schema.yaml +0 -17
  31. package/source/uris/validate.js +0 -17
  32. package/source/variable.js +0 -12
  33. package/test/deployment.test.js +0 -92
  34. package/test/pointer.test.js +0 -213
  35. package/test/uris.fixtures.js +0 -10
  36. package/test/uris.test.js +0 -146
  37. package/test/variable.test.js +0 -37
  38. package/transpiled/Deployment.d.ts +0 -15
  39. package/transpiled/Deployment.js +0 -42
  40. package/transpiled/Deployment.js.map +0 -1
  41. package/transpiled/Variables.d.ts +0 -15
  42. package/transpiled/Variables.js +0 -42
  43. package/transpiled/Variables.js.map +0 -1
  44. package/transpiled/annotation.d.ts +0 -3
  45. package/transpiled/annotation.js +0 -62
  46. package/transpiled/annotation.js.map +0 -1
  47. package/transpiled/createDeployment.d.ts +0 -4
  48. package/transpiled/createDeployment.js +0 -12
  49. package/transpiled/createDeployment.js.map +0 -1
  50. package/transpiled/createVariables.d.ts +0 -4
  51. package/transpiled/createVariables.js +0 -12
  52. package/transpiled/createVariables.js.map +0 -1
  53. package/transpiled/env.d.ts +0 -1
  54. package/transpiled/env.js +0 -10
  55. package/transpiled/env.js.map +0 -1
  56. package/transpiled/index.d.ts +0 -4
  57. package/transpiled/index.js +0 -8
  58. package/transpiled/index.js.map +0 -1
  59. package/transpiled/resolve.d.ts +0 -1
  60. package/transpiled/resolve.js +0 -25
  61. package/transpiled/resolve.js.map +0 -1
  62. package/transpiled/tsconfig.tsbuildinfo +0 -1
  63. package/types/_uris.d.ts +0 -27
  64. package/types/deployment.d.ts +0 -21
  65. package/types/index.d.ts +0 -1
  66. package/types/pointer.d.ts +0 -19
  67. package/types/uris.d.ts +0 -19
  68. package/types/variable.d.ts +0 -8
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolve = exports.createVariables = void 0;
4
- var createVariables_1 = require("./createVariables");
5
- Object.defineProperty(exports, "createVariables", { enumerable: true, get: function () { return createVariables_1.createVariables; } });
6
- var resolve_1 = require("./resolve");
7
- Object.defineProperty(exports, "resolve", { enumerable: true, get: function () { return resolve_1.resolve; } });
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AACxB,qCAAmC;AAA1B,kGAAA,OAAO,OAAA"}
@@ -1 +0,0 @@
1
- export declare function resolve(id: string, selector: string): string[];
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolve = void 0;
4
- const env_1 = require("./env");
5
- function resolve(id, selector) {
6
- const variable = (0, env_1.nameVariable)(id, selector);
7
- const value = process.env[variable];
8
- if (value === undefined)
9
- throw new Error(`${variable} is not set.`);
10
- const urls = value.split(' ');
11
- return withCredentials(variable, urls);
12
- }
13
- exports.resolve = resolve;
14
- function withCredentials(variable, urls) {
15
- const username = process.env[variable + '_USERNAME'] ?? '';
16
- const password = process.env[variable + '_PASSWORD'] ?? '';
17
- return urls.map((url) => addCredentials(url, username, password));
18
- }
19
- function addCredentials(ref, username, password) {
20
- const url = new URL(ref);
21
- url.username = username;
22
- url.password = password;
23
- return url.href;
24
- }
25
- //# sourceMappingURL=resolve.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../source/resolve.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AAEpC,SAAgB,OAAO,CAAE,EAAU,EAAE,QAAgB;IACnD,MAAM,QAAQ,GAAG,IAAA,kBAAY,EAAC,EAAE,EAAE,QAAQ,CAAC,CAAA;IAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAEnC,IAAI,KAAK,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,cAAc,CAAC,CAAA;IAEnE,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAE7B,OAAO,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;AACxC,CAAC;AATD,0BASC;AAED,SAAS,eAAe,CAAE,QAAgB,EAAE,IAAc;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,CAAA;IAC1D,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,CAAA;IAE1D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAA;AACnE,CAAC;AAED,SAAS,cAAc,CAAE,GAAW,EAAE,QAAgB,EAAE,QAAgB;IACtE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;IAExB,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAA;IACvB,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAEvB,OAAO,GAAG,CAAC,IAAI,CAAA;AACjB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":"4.9.5"}
package/types/_uris.d.ts DELETED
@@ -1,27 +0,0 @@
1
- import { Locator } from '@toa.io/core/types'
2
-
3
- declare namespace toa.pointer {
4
-
5
- namespace uris {
6
-
7
- type Node = string | {
8
- [key: string]: Node
9
- }
10
-
11
- type Resolution = {
12
- url: URL
13
- entry: string
14
- }
15
-
16
- type Resolver = (locator: Locator, uris: URIs) => Resolution
17
-
18
- }
19
-
20
- type URIs = string | {
21
- default?: string
22
- [key: string]: uris.Node
23
- }
24
-
25
- }
26
-
27
- export type URIs = toa.pointer.URIs
@@ -1,21 +0,0 @@
1
- import { dependency } from '@toa.io/operations/types/deployment'
2
- import { dependencies } from '@toa.io/norm/types'
3
- import * as _uris from './uris'
4
-
5
- declare namespace toa.pointer {
6
-
7
- namespace deployment {
8
-
9
- type Options = {
10
- prefix: string
11
- }
12
-
13
- }
14
-
15
- type Deployment = (
16
- instances: dependencies.Instance[],
17
- uris: _uris.URIs,
18
- options: deployment.Options
19
- ) => dependency.Declaration
20
-
21
- }
package/types/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * as uris from './uris'
@@ -1,19 +0,0 @@
1
- declare namespace toa.pointer {
2
-
3
- type Options = {
4
- protocol: string // for local environment
5
- }
6
-
7
- interface Pointer {
8
- protocol: string
9
- host: string
10
- port: number
11
- hostname: string
12
- path: string
13
- username: string
14
- password: string
15
- reference: string
16
- label: string // safe for logging
17
- }
18
-
19
- }
package/types/uris.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import type { Locator } from '@toa.io/core'
2
-
3
- export function construct (declaration: URIs | string): URIs
4
-
5
- export function resolve (locator: Locator, uris: URIs): Resolution
6
-
7
- type Node = string | {
8
- [key: string]: Node
9
- }
10
-
11
- type URIs = string | {
12
- default?: string
13
- [key: string]: Node
14
- }
15
-
16
- type Resolution = {
17
- url: URL
18
- entry: string
19
- }
@@ -1,8 +0,0 @@
1
- import { Locator } from '@toa.io/core/types'
2
- import { dependency } from '@toa.io/operations/types/deployment'
3
-
4
- declare namespace toa.pointer {
5
- type Variable = (scope: string, locator: Locator, label: string, value: string | number) => dependency.Variable
6
- }
7
-
8
- export const variable: toa.pointer.Variable